From e44f1c50e51ed7cdd484ef0fcc7bfdb633a345b1 Mon Sep 17 00:00:00 2001 From: "Lee Xiong Jie, Isaac" <68138671+luminousleek@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:48:37 +0800 Subject: [PATCH] Add tests for logger output when overriding attributes (#2525) Currently only certain components are tested for logger warnings when their attributes are overridden by slots. Let's add tests for the remaining attributes and components, as well as add missing tests for the components which do not currently have tests. --- .../core/test/unit/html/NodeProcessor.data.ts | 250 +++++++++++++++++- .../core/test/unit/html/NodeProcessor.test.ts | 151 ++++++++++- 2 files changed, 391 insertions(+), 10 deletions(-) diff --git a/packages/core/test/unit/html/NodeProcessor.data.ts b/packages/core/test/unit/html/NodeProcessor.data.ts index 0f6900c05a..142548b09b 100644 --- a/packages/core/test/unit/html/NodeProcessor.data.ts +++ b/packages/core/test/unit/html/NodeProcessor.data.ts @@ -43,6 +43,26 @@ export const PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` export const PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "panel has a header slot, 'header' attribute has no effect."; +export const PROCESS_PANEL_ALT_SLOT_TAKES_PRIORITY = ` + +
+ Alt slot text +
+ Alt attribute should be ignored and deleted while alt slot is reserved. +
+`; + +export const PROCESS_PANEL_ALT_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Alt attribute should be ignored and deleted while alt slot is reserved. + +`; + +export const PROCESS_PANEL_ALT_SLOT_TAKES_PRIORITY_WARN_MSG = "panel has a _alt slot, 'alt' attribute has no effect."; + // Post Process export const POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT = ` @@ -86,6 +106,8 @@ export const PROCESS_QUESTION_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` `; +export const PROCESS_QUESTION_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "question has a header slot, 'header' attribute has no effect."; + export const PROCESS_QUESTION_HINT_SLOT_TAKES_PRIORITY = ` @@ -98,6 +120,8 @@ export const PROCESS_QUESTION_HINT_SLOT_TAKES_PRIORITY_EXPECTED = ` `; +export const PROCESS_QUESTION_HINT_SLOT_TAKES_PRIORITY_WARN_MSG = "question has a hint slot, 'hint' attribute has no effect."; + export const PROCESS_QUESTION_ANSWER_SLOT_TAKES_PRIORITY = ` @@ -110,6 +134,8 @@ export const PROCESS_QUESTION_ANSWER_SLOT_TAKES_PRIORITY_EXPECTED = ` `; +export const PROCESS_QUESTION_ANSWER_SLOT_TAKES_PRIORITY_WARN_MSG = "question has a answer slot, 'answer' attribute has no effect."; + export const PROCESS_QOPTION_ATTRIBUTES = ` @@ -133,6 +159,8 @@ export const PROCESS_QOPTION_REASON_SLOT_TAKES_PRIORITY_EXPECTED = ` `; +export const PROCESS_QOPTION_REASON_SLOT_TAKES_PRIORITY_WARN_MSG = "q-option has a reason slot, 'reason' attribute has no effect."; + export const PROCESS_QUIZ_ATTRIBUTES = ` @@ -156,6 +184,8 @@ export const PROCESS_QUIZ_INTRO_SLOT_TAKES_PRIORITY_EXPECTED = ` `; +export const PROCESS_QUIZ_INTRO_SLOT_TAKES_PRIORITY_WARN_MSG = "quiz has a intro slot, 'intro' attribute has no effect."; + /* * Popovers */ @@ -187,7 +217,7 @@ export const PROCESS_POPOVER_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` `; -export const PROCESS_POPOVER_ATTRIBUTES_NO_OVERRIDE_HEADER_WARN_MSG = "popover has a header slot, 'header' attribute has no effect."; +export const PROCESS_POPOVER_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "popover has a header slot, 'header' attribute has no effect."; export const PROCESS_POPOVER_CONTENT_SLOT_TAKES_PRIORITY = ` @@ -202,7 +232,20 @@ export const PROCESS_POPOVER_CONTENT_SLOT_TAKES_PRIORITY_EXPECTED = ` Content attribute should not be inserted under panel as slot, but should be deleted. `; -export const PROCESS_POPOVER_ATTRIBUTES_NO_OVERRIDE_CONTENT_WARN_MSG = "popover has a content slot, 'content' attribute has no effect."; +export const PROCESS_POPOVER_CONTENT_SLOT_TAKES_PRIORITY_WARN_MSG = "popover has a content slot, 'content' attribute has no effect."; + +export const PROCESS_POPOVER_CONTENT_ATTRIBUTE_TAKES_PRIORITY = ` + + Src attribute should not be inserted under panel as slot, but should be deleted. + +`; + +export const PROCESS_POPOVER_CONTENT_ATTRIBUTE_TAKES_PRIORITY_EXPECTED = ` + + Src attribute should not be inserted under panel as slot, but should be deleted. + +`; +export const PROCESS_POPOVER_CONTENT_ATTRIBUTE_TAKES_PRIORITY_WARN_MSG = "popover has a 'content' attribute, 'src' attribute has no effect."; /* * Tooltips @@ -220,6 +263,22 @@ export const PROCESS_TOOLTIP_CONTENT_EXPECTED = ` `; +export const PROCESS_TOOLTIP_CONTENT_SLOT_TAKES_PRIORITY = ` + +
Some content slot that should not be overwritten
+ Content attribute should not be inserted under tooltip as slot, but should be deleted. +
+`; + +export const PROCESS_TOOLTIP_CONTENT_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Content attribute should not be inserted under tooltip as slot, but should be deleted. + +`; + +export const PROCESS_TOOLTIP_CONTENT_SLOT_TAKES_PRIORITY_WARN_MSG = "tooltip has a content slot, 'content' attribute has no effect."; + /* * Modals */ @@ -248,6 +307,22 @@ export const PROCESS_MODAL_OK_TEXT_EXPECTED = ` `; +export const PROCESS_MODAL_HEADER_SLOT_TAKES_PRIORITY = ` + +
Some header slot content that should not be overwritten
+ Header attribute should not be inserted under modal as slot, but should be deleted. +
+`; + +export const PROCESS_MODAL_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Header attribute should not be inserted under modal as slot, but should be deleted. + +`; + +export const PROCESS_MODAL_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "modal has a header slot, 'header' attribute has no effect."; + /* * Tab, tab-group */ @@ -264,6 +339,22 @@ export const PROCESS_TAB_HEADER_EXPECTED = ` `; +export const PROCESS_TAB_HEADER_SLOT_TAKES_PRIORITY = ` + +
Some header slot content that should not be overwritten
+ Header attribute should not be inserted under tab as slot, but should be deleted. +
+`; + +export const PROCESS_TAB_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Header attribute should not be inserted under tab as slot, but should be deleted. + +`; + +export const PROCESS_TAB_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "tab has a header slot, 'header' attribute has no effect."; + export const PROCESS_TAB_GROUP_HEADER = ` Header attribute should be inserted as header slot and deleted. @@ -276,6 +367,22 @@ export const PROCESS_TAB_GROUP_HEADER_EXPECTED = ` `; +export const PROCESS_TAB_GROUP_HEADER_SLOT_TAKES_PRIORITY = ` + +
Some header slot content that should not be overwritten
+ Header attribute should not be inserted under tab-group as slot, but should be deleted. +
+`; + +export const PROCESS_TAB_GROUP_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Header attribute should not be inserted under tab-group as slot, but should be deleted. + +`; + +export const PROCESS_TAB_GROUP_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "tab-group has a header slot, 'header' attribute has no effect."; + /* * Boxes */ @@ -305,6 +412,38 @@ export const PROCESS_BOX_HEADER_EXPECTED = ` `; +export const PROCESS_BOX_ICON_SLOT_TAKES_PRIORITY = ` + +
:rocket:
+ Icon attribute should not be inserted under box as slot, but should be deleted. +
+`; + +export const PROCESS_BOX_ICON_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Icon attribute should not be inserted under box as slot, but should be deleted. + +`; + +export const PROCESS_BOX_ICON_SLOT_TAKES_PRIORITY_WARN_MSG = "box has a icon slot, 'icon' attribute has no effect."; + +export const PROCESS_BOX_HEADER_SLOT_TAKES_PRIORITY = ` + +
Some header slot content that should not be overwritten
+ Header attribute should not be inserted under box as slot, but should be deleted. +
+`; + +export const PROCESS_BOX_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + Header attribute should not be inserted under box as slot, but should be deleted. + +`; + +export const PROCESS_BOX_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "box has a header slot, 'header' attribute has no effect."; + /** * Dropdowns */ @@ -337,4 +476,111 @@ export const PROCESS_DROPDOWN_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` export const PROCESS_DROPDOWN_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "dropdown has a header slot, 'header' attribute has no effect."; +/** + * Scroll-to-top button + */ + +export const PROCESS_SCROLL_TOP_BUTTON_ICON = ` + + +`; + +export const PROCESS_SCROLL_TOP_BUTTON_ICON_EXPECTED = ` + + +`; + +export const PROCESS_SCROLL_TOP_BUTTON_ICON_SLOT_TAKES_PRIORITY = ` + +
:rocket:
+
+`; + +export const PROCESS_SCROLL_TOP_BUTTON_ICON_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + +`; + +export const PROCESS_SCROLL_TOP_BUTTON_ICON_SLOT_TAKES_PRIORITY_WARN_MSG = "scroll-top-button has a icon slot, 'icon' attribute has no effect."; + +/** + * A-points + */ + +export const PROCESS_A_POINT_HEADER = ` + + +`; + +export const PROCESS_A_POINT_HEADER_EXPECTED = ` + + +`; + +export const PROCESS_A_POINT_CONTENT = ` + + +`; + +export const PROCESS_A_POINT_CONTENT_EXPECTED = ` + + +`; + +export const PROCESS_A_POINT_LABEL = ` + + +`; + +export const PROCESS_A_POINT_LABEL_EXPECTED = ` + + +`; + +export const PROCESS_A_POINT_HEADER_SLOT_TAKES_PRIORITY = ` + +
Some header slot content that should not be overwritten
+
+`; + +export const PROCESS_A_POINT_HEADER_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + +`; + +export const PROCESS_A_POINT_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG = "a-point has a header slot, 'header' attribute has no effect."; + +export const PROCESS_A_POINT_CONTENT_SLOT_TAKES_PRIORITY = ` + +
Some content slot content that should not be overwritten
+
+`; + +export const PROCESS_A_POINT_CONTENT_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + +`; + +export const PROCESS_A_POINT_CONTENT_SLOT_TAKES_PRIORITY_WARN_MSG = "a-point has a content slot, 'content' attribute has no effect."; + +export const PROCESS_A_POINT_LABEL_SLOT_TAKES_PRIORITY = ` + +
O
+
+`; + +export const PROCESS_A_POINT_LABEL_SLOT_TAKES_PRIORITY_EXPECTED = ` + + + +`; + +export const PROCESS_A_POINT_LABEL_SLOT_TAKES_PRIORITY_WARN_MSG = "a-point has a label slot, 'label' attribute has no effect."; + /* eslint-enable max-len */ diff --git a/packages/core/test/unit/html/NodeProcessor.test.ts b/packages/core/test/unit/html/NodeProcessor.test.ts index 8e7e8cf5be..b94afade25 100644 --- a/packages/core/test/unit/html/NodeProcessor.test.ts +++ b/packages/core/test/unit/html/NodeProcessor.test.ts @@ -52,30 +52,66 @@ const processAndVerifyTemplate = (template: string, expectedTemplate: string, po }; test('processNode processes panel attributes and inserts into dom as slots correctly', () => { - const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_PANEL_ATTRIBUTES, testData.PROCESS_PANEL_ATTRIBUTES_EXPECTED); +}); + +test('processNode processes panel with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY, testData.PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_PANEL_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); }); +test('processNode processes panel with _alt slot taking priority over alt attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_PANEL_ALT_SLOT_TAKES_PRIORITY, + testData.PROCESS_PANEL_ALT_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_PANEL_ALT_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('postProcessNode assigns the correct panel id to panels', () => { + processAndVerifyTemplate(testData.POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT, + testData.POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT_EXPECTED, + true); +}); + test('processNode processes question attributes and inserts into dom as slots correctly', () => { processAndVerifyTemplate(testData.PROCESS_QUESTION_ATTRIBUTES, testData.PROCESS_QUESTION_ATTRIBUTES_EXPECTED); +}); + +test('processNode processes question with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_QUESTION_HEADER_SLOT_TAKES_PRIORITY, testData.PROCESS_QUESTION_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_QUESTION_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes question with hint slot taking priority over hint attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_QUESTION_HINT_SLOT_TAKES_PRIORITY, testData.PROCESS_QUESTION_HINT_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_QUESTION_HINT_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes question with answer slot taking priority over answer attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_QUESTION_ANSWER_SLOT_TAKES_PRIORITY, testData.PROCESS_QUESTION_ANSWER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_QUESTION_ANSWER_SLOT_TAKES_PRIORITY_WARN_MSG); }); test('processNode processes q-option attributes and inserts into dom as slots correctly', () => { processAndVerifyTemplate(testData.PROCESS_QOPTION_ATTRIBUTES, testData.PROCESS_QOPTION_ATTRIBUTES_EXPECTED); +}); + +test('processNode processes q-option with reason slot taking priority over reason attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_QOPTION_REASON_SLOT_TAKES_PRIORITY, testData.PROCESS_QOPTION_REASON_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_QOPTION_REASON_SLOT_TAKES_PRIORITY_WARN_MSG); }); test('processNode processes quiz attributes and inserts into dom as slots correctly', () => { @@ -85,16 +121,37 @@ test('processNode processes quiz attributes and inserts into dom as slots correc testData.PROCESS_QUIZ_INTRO_SLOT_TAKES_PRIORITY_EXPECTED); }); -test('processNode processes popover attributes and inserts into dom as slots correctly', () => { +test('processNode processes quiz with intro slot taking priority over intro attribute', () => { const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_QUIZ_INTRO_SLOT_TAKES_PRIORITY, + testData.PROCESS_QUIZ_INTRO_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_QUIZ_INTRO_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes popover attributes and inserts into dom as slots correctly', () => { processAndVerifyTemplate(testData.PROCESS_POPOVER_ATTRIBUTES, testData.PROCESS_POPOVER_ATTRIBUTES_EXPECTED); +}); + +test('processNode processes popover with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_POPOVER_HEADER_SLOT_TAKES_PRIORITY, testData.PROCESS_POPOVER_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); - expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_POPOVER_ATTRIBUTES_NO_OVERRIDE_HEADER_WARN_MSG); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_POPOVER_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes popover with content slot taking priority over content attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); processAndVerifyTemplate(testData.PROCESS_POPOVER_CONTENT_SLOT_TAKES_PRIORITY, testData.PROCESS_POPOVER_CONTENT_SLOT_TAKES_PRIORITY_EXPECTED); - expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_POPOVER_ATTRIBUTES_NO_OVERRIDE_CONTENT_WARN_MSG); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_POPOVER_CONTENT_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes popover with content attribute taking priority over src attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_POPOVER_CONTENT_ATTRIBUTE_TAKES_PRIORITY, + testData.PROCESS_POPOVER_CONTENT_ATTRIBUTE_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_POPOVER_CONTENT_ATTRIBUTE_TAKES_PRIORITY_WARN_MSG); }); test('processNode processes tooltip attributes and inserts into dom as slots correctly', () => { @@ -102,6 +159,13 @@ test('processNode processes tooltip attributes and inserts into dom as slots cor testData.PROCESS_TOOLTIP_CONTENT_EXPECTED); }); +test('processNode processes tooltip with content slot taking priority over content attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_TOOLTIP_CONTENT_SLOT_TAKES_PRIORITY, + testData.PROCESS_TOOLTIP_CONTENT_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_TOOLTIP_CONTENT_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + test('processNode processes modal attributes and inserts into dom as slots correctly', () => { processAndVerifyTemplate(testData.PROCESS_MODAL_HEADER, testData.PROCESS_MODAL_HEADER_EXPECTED); @@ -111,6 +175,13 @@ test('processNode processes modal attributes and inserts into dom as slots corre testData.PROCESS_MODAL_OK_TEXT_EXPECTED); }); +test('processNode processes modal with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_MODAL_HEADER_SLOT_TAKES_PRIORITY, + testData.PROCESS_MODAL_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_MODAL_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + test('processNode processes tab & tab-group attributes and inserts into dom as slots correctly', () => { processAndVerifyTemplate(testData.PROCESS_TAB_HEADER, testData.PROCESS_TAB_HEADER_EXPECTED); @@ -118,6 +189,20 @@ test('processNode processes tab & tab-group attributes and inserts into dom as s testData.PROCESS_TAB_GROUP_HEADER_EXPECTED); }); +test('processNode processes tab with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_TAB_HEADER_SLOT_TAKES_PRIORITY, + testData.PROCESS_TAB_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_TAB_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes tab-group with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_TAB_GROUP_HEADER_SLOT_TAKES_PRIORITY, + testData.PROCESS_TAB_GROUP_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_TAB_GROUP_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + test('processNode processes box attributes and inserts into dom as slots correctly', () => { processAndVerifyTemplate(testData.PROCESS_BOX_ICON, testData.PROCESS_BOX_ICON_EXPECTED); @@ -125,10 +210,18 @@ test('processNode processes box attributes and inserts into dom as slots correct testData.PROCESS_BOX_HEADER_EXPECTED); }); -test('postProcessNode assigns the correct panel id to panels', () => { - processAndVerifyTemplate(testData.POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT, - testData.POST_PROCESS_PANEL_ID_ASSIGNED_USING_HEADER_SLOT_EXPECTED, - true); +test('processNode processes box with icon slot taking priority over icon attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_BOX_ICON_SLOT_TAKES_PRIORITY, + testData.PROCESS_BOX_ICON_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_BOX_ICON_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes box with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_BOX_HEADER_SLOT_TAKES_PRIORITY, + testData.PROCESS_BOX_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_BOX_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); }); test('processNode processes dropdown header attribute and inserts into DOM as header slot correctly', () => { @@ -143,6 +236,48 @@ test('processNode processes dropdown with header slot taking priority over heade expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_DROPDOWN_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); }); +test('processNode processes scroll-top-button attributes and inserts into dom as slots correctly', () => { + processAndVerifyTemplate(testData.PROCESS_SCROLL_TOP_BUTTON_ICON, + testData.PROCESS_SCROLL_TOP_BUTTON_ICON_EXPECTED); +}); + +test('processNode processes scroll-top-button with icon slot taking priority over icon attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_SCROLL_TOP_BUTTON_ICON_SLOT_TAKES_PRIORITY, + testData.PROCESS_SCROLL_TOP_BUTTON_ICON_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_SCROLL_TOP_BUTTON_ICON_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes a-point attributes and inserts into dom as slots correctly', () => { + processAndVerifyTemplate(testData.PROCESS_A_POINT_HEADER, + testData.PROCESS_A_POINT_HEADER_EXPECTED); + processAndVerifyTemplate(testData.PROCESS_A_POINT_CONTENT, + testData.PROCESS_A_POINT_CONTENT_EXPECTED); + processAndVerifyTemplate(testData.PROCESS_A_POINT_LABEL, + testData.PROCESS_A_POINT_LABEL_EXPECTED); +}); + +test('processNode processes a-point with header slot taking priority over header attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_A_POINT_HEADER_SLOT_TAKES_PRIORITY, + testData.PROCESS_A_POINT_HEADER_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_A_POINT_HEADER_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes a-point with content slot taking priority over content attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_A_POINT_CONTENT_SLOT_TAKES_PRIORITY, + testData.PROCESS_A_POINT_CONTENT_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_A_POINT_CONTENT_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + +test('processNode processes a-point with label slot taking priority over label attribute', () => { + const warnSpy = jest.spyOn(logger, 'warn'); + processAndVerifyTemplate(testData.PROCESS_A_POINT_LABEL_SLOT_TAKES_PRIORITY, + testData.PROCESS_A_POINT_LABEL_SLOT_TAKES_PRIORITY_EXPECTED); + expect(warnSpy).toHaveBeenCalledWith(testData.PROCESS_A_POINT_LABEL_SLOT_TAKES_PRIORITY_WARN_MSG); +}); + test('processNode does not log warning when lazy pic has width or height', () => { const nodeProcessor = getNewDefaultNodeProcessor();