mirror of
https://github.com/tabler/tabler.git
synced 2026-10-13 13:47:00 +04:00
24 lines
1.1 KiB
SCSS
24 lines
1.1 KiB
SCSS
@use 'sass:meta';
|
|
// Tests for `escape-svg()` from scss/mixins/_functions.scss.
|
|
//
|
|
// It iterates the global `$escaped-characters` map, which lives in
|
|
// scss/_settings.scss (already `@use`d by functions.scss), so a plain `@use` of
|
|
// the functions module is enough — no fixtures. Escaping only happens when the
|
|
// string looks like an SVG data URI; anything else is returned untouched.
|
|
|
|
@use '../mixins/functions' as *;
|
|
|
|
@include describe('escape-svg') {
|
|
@include it('percent-encodes % so oklch() lightness survives inside a data uri') {
|
|
@include assert-equal(meta.inspect(escape-svg('url("data:image/svg+xml,<path stroke=\'oklch(54.6% 0.17 254deg)\'/>")')), 'url("data:image/svg+xml,%3cpath stroke=\'oklch%2854.6%25 0.17 254deg%29\'/%3e")');
|
|
}
|
|
|
|
@include it('returns a non data-URI string unchanged') {
|
|
@include assert-equal(escape-svg('no data uri <here>'), 'no data uri <here>');
|
|
}
|
|
|
|
@include it('percent-encodes reserved characters inside an SVG data URI') {
|
|
@include assert-equal(escape-svg('data:image/svg+xml,<svg><path/></svg>'), 'data:image/svg+xml,%3csvg%3e%3cpath/%3e%3c/svg%3e');
|
|
}
|
|
}
|