File: mediaQueries.php

package info (click to toggle)
php-nunomaduro-termwind 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,172 kB
  • sloc: php: 3,969; makefile: 34
file content (37 lines) | stat: -rw-r--r-- 884 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

use Termwind\Actions\StyleToMethod;

use function Termwind\parse;

it('supports styling', function ($name) {
    putenv('COLUMNS='.StyleToMethod::MEDIA_QUERY_BREAKPOINTS[$name]);

    $html = parse(<<<HTML
        <div class="w-full {$name}:w-1"></div>
    HTML);

    expect($html)->toBe(' ');
})->with(array_keys(StyleToMethod::MEDIA_QUERY_BREAKPOINTS));

it('renders based on the size even if the styles are in the wrong order', function () {
    putenv('COLUMNS=64');

    $html = parse(<<<'HTML'
        <div class="md:bg-blue lg:bg-purple sm:bg-red bg-green">
            Test
        </div>
    HTML);

    expect($html)->toBe('<bg=red>Test</>');
});

it('resets the width when the breakpoint is reached', function () {
    putenv('COLUMNS=64');

    $html = parse(<<<'HTML'
        <div class="w-2 sm:w-auto">text</div>
    HTML);

    expect($html)->toBe('text');
});