-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
96 additions
and
142 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Bugo\FontAwesomeHelper\Enums\Icon; | ||
use Bugo\FontAwesomeHelper\IconBuilder; | ||
|
||
beforeEach(function () { | ||
$this->builderV5 = new IconBuilder(Icon::V5->solid('calendar')); | ||
$this->builderV6 = new IconBuilder(Icon::V6->regular('user')); | ||
}); | ||
|
||
test('text method', function () { | ||
expect($this->builderV6->text())->toBe('fa-regular fa-user') | ||
->and($this->builderV5->text())->toBe('fas fa-calendar'); | ||
}); | ||
|
||
test('html method', function () { | ||
expect($this->builderV6->html()) | ||
->toBe('<i class="fa-regular fa-user"></i>'); | ||
}); | ||
|
||
test('addClass method', function () { | ||
expect($this->builderV5->addClass('fa-spin')->text()) | ||
->toBe('fas fa-calendar fa-spin'); | ||
}); | ||
|
||
describe('color method', function () { | ||
test('tailwind classes', function () { | ||
expect($this->builderV5->color('text-red-500')->html()) | ||
->toBe('<i class="fas fa-calendar text-red-500"></i>'); | ||
}); | ||
|
||
test('common styles', function () { | ||
expect($this->builderV5->color('#000')->html()) | ||
->toBe('<i class="fas fa-calendar" style="color:#000"></i>'); | ||
}); | ||
}); | ||
|
||
describe('size method', function () { | ||
test('correct size', function () { | ||
expect($this->builderV5->size('lg')->text()) | ||
->toBe('fas fa-calendar fa-lg'); | ||
}); | ||
|
||
test('incorrect size', function () { | ||
expect(fn() => $this->builderV5->size('10px')->text()) | ||
->toThrow(InvalidArgumentException::class, 'Invalid size: 10px'); | ||
}); | ||
}); | ||
|
||
test('title method', function () { | ||
expect($this->builderV5->title('Calendar')->html()) | ||
->toBe('<i class="fas fa-calendar" title="Calendar"></i>'); | ||
}); | ||
|
||
test('fixedWidth method', function () { | ||
expect($this->builderV5->fixedWidth()->text()) | ||
->toBe('fas fa-calendar fa-fw'); | ||
}); | ||
|
||
test('ariaHidden method', function () { | ||
expect($this->builderV5->ariaHidden()->html()) | ||
->toBe('<i class="fas fa-calendar" aria-hidden="true"></i>'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Bugo\FontAwesomeHelper\Enums\Icon; | ||
|
||
test('brand method', function () { | ||
expect(Icon::V5->brand('42-group'))->toBe('fab fa-42-group') | ||
->and(Icon::V6->brand('windows'))->toBe('fa-brands fa-windows'); | ||
}); | ||
|
||
test('regular method', function () { | ||
expect(Icon::V5->regular('user'))->toBe('far fa-user') | ||
->and(Icon::V6->regular('clock'))->toBe('fa-regular fa-clock'); | ||
}); | ||
|
||
test('solid method', function () { | ||
expect(Icon::V5->solid('user'))->toBe('fas fa-user') | ||
->and(Icon::V6->solid('folder'))->toBe('fa-solid fa-folder'); | ||
}); | ||
|
||
test('unkhown icon', function () { | ||
expect(Icon::V5->brand('foo'))->toBe('') | ||
->and(Icon::V6->brand('bar'))->toBe(''); | ||
}); | ||
|
||
test('collection method', function () { | ||
expect(Icon::V5->collection())->toBeArray() | ||
->and(Icon::V6->collection())->toContain('fa-solid fa-user'); | ||
}); | ||
|
||
test('random method', function () { | ||
expect(Icon::V5->random())->toBeString() | ||
->and(Icon::V6->random())->not->toBe(Icon::V6->random()); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.