We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a5de07 commit c6e2516Copy full SHA for c6e2516
tests/Feature/TypographyTest.php
@@ -1,6 +1,7 @@
1
<?php
2
3
use Whitecube\Strings\ServiceProvider;
4
+use Whitecube\Strings\Typography;
5
6
it('can load ServiceProvider correctly', function() {
7
expect(app()->providerIsLoaded(ServiceProvider::class))->toBeTrue();
@@ -40,3 +41,17 @@
40
41
expect((string) str($value)->typography())->toBe($expectation);
42
}
43
});
44
+
45
+it('can register and remove custom typographic rules', function() {
46
+ Typography::rule(
47
+ key: 'a-to-b',
48
+ regex: '/a/',
49
+ callback: fn(array $matches) => 'b',
50
+ );
51
52
+ expect((string) str('...Banana !')->typography())->toBe('…Bbnbnb !');
53
54
+ Typography::remove('a-to-b');
55
56
+ expect((string) str('...Banana !')->typography())->toBe('…Banana !');
57
+});
0 commit comments