File: hr.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 (44 lines) | stat: -rw-r--r-- 997 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
38
39
40
41
42
43
44
<?php

use function Termwind\parse;

it('renders the element', function () {
    putenv('COLUMNS=10');

    $html = parse('<hr>');

    expect($html)
        ->toContain('─')
        ->toBe(str_repeat('─', 10));
});

it('can be styled', function () {
    putenv('COLUMNS=10');

    $html = parse('<hr class="text-red">');

    expect($html)->toBe('<fg=red>'.str_repeat('─', 10).'</>');
});

it('accepts the margins and remove from the length if w-full', function () {
    putenv('COLUMNS=10');

    $html = parse('<hr class="mx-1 text-red">');

    expect($html)->toBe(' <fg=red>'.str_repeat('─', 8).'</> ');
});

it('accepts width', function () {
    putenv('COLUMNS=10');

    $html = parse('<hr class="w-5 mx-2 text-red">');

    expect($html)->toBe('  <fg=red>'.str_repeat('─', 5).'</>  ');
});

it('respects the parent width', function () {
    putenv('COLUMNS=10');

    $html = parse('<div class="mx-2"><hr /></div>');
    expect($html)->toBe('  '.str_repeat('─', 6).'  ');
});