@@ -2706,13 +2706,24 @@ describe('Test lib.js:', function () {
27062706 });
27072707
27082708 // This test must come after the warning count since it will affect the count
2709- it('replaces missing matches with fallback value ', function () {
2709+ it('replaces template specifiers where the key is missing with the specifier ', () => {
27102710 expect(
27112711 Lib.hovertemplateString({
27122712 data: [{ group: 1 }],
27132713 fallback: 'Planet Express',
27142714 template: 'foo %{group} %{trace}'
27152715 })
2716+ ).toEqual('foo 1 %{trace}');
2717+ });
2718+
2719+ // This test must come after the warning count since it will affect the count
2720+ it('replaces template specifiers where the value is undefined with the fallback value', () => {
2721+ expect(
2722+ Lib.hovertemplateString({
2723+ data: [{ group: 1, trace: undefined }],
2724+ fallback: 'Planet Express',
2725+ template: 'foo %{group} %{trace}'
2726+ })
27162727 ).toEqual('foo 1 Planet Express');
27172728 });
27182729 });
@@ -2762,13 +2773,24 @@ describe('Test lib.js:', function () {
27622773 });
27632774
27642775 // This test must come after the warning count since it will affect the count
2765- it('replaces missing matches with fallback value ', function () {
2776+ it('replaces template specifiers where the key is missing with the specifier ', () => {
27662777 expect(
27672778 Lib.texttemplateString({
27682779 data: [{ group: 1 }],
27692780 fallback: 'Zoidberg',
27702781 template: 'foo %{group} %{trace}'
27712782 })
2783+ ).toEqual('foo 1 %{trace}');
2784+ });
2785+
2786+ // This test must come after the warning count since it will affect the count
2787+ it('replaces template specifiers where the value is undefined with the fallback value', () => {
2788+ expect(
2789+ Lib.texttemplateString({
2790+ data: [{ group: 1, trace: undefined }],
2791+ fallback: 'Zoidberg',
2792+ template: 'foo %{group} %{trace}'
2793+ })
27722794 ).toEqual('foo 1 Zoidberg');
27732795 });
27742796 });
0 commit comments