From 72c29f7dfee2bdd7ded4113f0bbccc74d9ea60f9 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 19 Sep 2023 10:36:45 -0300 Subject: test: linkThing: basic tests (snapshot) --- test/snapshot/linkThing.js | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 test/snapshot/linkThing.js (limited to 'test/snapshot/linkThing.js') diff --git a/test/snapshot/linkThing.js b/test/snapshot/linkThing.js new file mode 100644 index 00000000..f76b17df --- /dev/null +++ b/test/snapshot/linkThing.js @@ -0,0 +1,76 @@ +import t from 'tap'; +import * as html from '#html'; +import {testContentFunctions} from '#test-lib'; + +testContentFunctions(t, 'linkThing (snapshot)', async (t, evaluate) => { + await evaluate.load(); + + const quickSnapshot = (message, oneOrMultiple) => + evaluate.snapshot(message, + (Array.isArray(oneOrMultiple) + ? {name: 'linkThing', multiple: oneOrMultiple} + : {name: 'linkThing', ...oneOrMultiple})); + + quickSnapshot('basic behavior', { + args: ['localized.track', { + directory: 'foo', + color: '#abcdef', + name: `Cool track!`, + }], + }); + + quickSnapshot('preferShortName', { + args: ['localized.tag', { + directory: 'five-oceanfalls', + name: 'Five (Oceanfalls)', + nameShort: 'Five', + }], + slots: {preferShortName: true}, + }); + + quickSnapshot('tooltip & content', { + args: ['localized.album', { + directory: 'beyond-canon', + name: 'Beyond Canon', + }], + multiple: [ + {slots: {tooltip: false}}, + {slots: {tooltip: true}}, + {slots: {tooltip: true, content: 'Next'}}, + {slots: {tooltip: 'Apple', content: 'Banana'}}, + {slots: {content: 'Banana'}}, + ], + }); + + quickSnapshot('color', { + args: ['localized.track', { + directory: 'showtime-piano-refrain', + name: 'Showtime (Piano Refrain)', + color: '#38f43d', + }], + multiple: [ + {slots: {color: false}}, + {slots: {color: true}}, + {slots: {color: '#aaccff'}}, + ], + }); + + quickSnapshot('tags in name escaped', [ + {args: ['localized.track', { + directory: 'foo', + name: `AS USUAL I SEE`, + }]}, + {args: ['localized.track', { + directory: 'bar', + name: `boldface`, + }]}, + {args: ['localized.album', { + directory: 'exile', + name: '>Exile<', + }]}, + {args: ['localized.track', { + directory: 'heart', + name: '<3', + }]}, + ]); +}); -- cgit 1.3.0-6-gf8a5