testCopy with a {routerLink: testName, testLink} inside of it
and two paragraphs
",
+ },
+ stubs: ["router-link"],
+ })
+ );
+ // Assert
+ expect(wrapper.findAll("p").length === 3).toBe(true);
+ });
+
+ it("Should call scrollIntoView() when the clientBoundingRect is not entirely in the viewport (out of view top)", () => {
+ // Arrange
+ var viewPortHeight = 200;
+ setUpViewPort(viewPortHeight);
+
+ Element.prototype.getBoundingClientRect = jest.fn(() => {
+ return { top: -100, bottom: 200 };
+ });
+
+ var mockScrollIntoView = jest.fn();
+ Element.prototype.scrollIntoView = mockScrollIntoView;
+
+ // Act
+ const wrapper = shallowMount(alert, setupMocks({}));
+
+ // Assert
+ // This is an implementation detail - we just need to test that the final step of snapping
+ // the window to the alert is working. If using a different function to accomplish that
+ // just swap this out with the new function
+ expect(mockScrollIntoView).toHaveBeenCalled();
+ });
+
+ it("Should call scrollIntoView() when the clientBoundingRect is not entirely in the viewport (bottom is hidden behind footer)", () => {
+ // Arrange
+ var viewPortHeight = 240;
+ setUpViewPort(viewPortHeight);
+
+ Element.prototype.getBoundingClientRect = jest.fn(() => {
+ return { top: 100, bottom: 200 };
+ });
+
+ var mockScrollIntoView = jest.fn();
+ Element.prototype.scrollIntoView = mockScrollIntoView;
+
+ // Act
+ const wrapper = shallowMount(alert, setupMocks({}));
+
+ // Assert
+ // This is an implementation detail - we just need to test that the final step of snapping
+ // the window to the alert is working. If using a different function to accomplish that
+ // just swap this out with the new function
+ expect(mockScrollIntoView).toHaveBeenCalled();
+ });
+
+ it("Should not call scrollIntoView() when the clientBoundingRect is not entirely in the viewport but 'shouldScrollToOnMount' is false", () => {
+ // Arrange
+ var viewPortHeight = 200;
+ setUpViewPort(viewPortHeight);
+
+ Element.prototype.getBoundingClientRect = jest.fn(() => {
+ return { top: -100, bottom: 200 };
+ });
+
+ var mockScrollIntoView = jest.fn();
+ Element.prototype.scrollIntoView = mockScrollIntoView;
+
+ // Act
+ const wrapper = shallowMount(
+ alert,
+ setupMocks({
+ propsData: {
+ shouldScrollToOnMount: false,
+ manualHeadline: "testHeader",
+ manualCopy: "testCopy",
+ },
+ })
+ );
+
+ // Assert
+ // This is an implementation detail - we just need to test that the final step of snapping
+ // the window to the alert is working. If using a different function to accomplish that
+ // just swap this out with the new function
+ expect(mockScrollIntoView).not.toHaveBeenCalled();
+ });
+
+ it("Should not call scrollIntoView() when the clientBoundingRect is entirely in the viewport", () => {
+ // Arrange
+ var viewPortHeight = 500;
+ setUpViewPort(viewPortHeight);
+
+ Element.prototype.getBoundingClientRect = jest.fn(() => {
+ return { top: 100, bottom: 200 };
+ });
+
+ var mockScrollIntoView = jest.fn();
+ Element.prototype.scrollIntoView = mockScrollIntoView;
+
+ // Act
+ const wrapper = shallowMount(alert, setupMocks({}));
+
+ // Assert
+ // This is an implementation detail - we just need to test that the final step of snapping
+ // the window to the alert is working. If using a different function to accomplish that
+ // just swap this out with the new function
+ expect(mockScrollIntoView).not.toHaveBeenCalled();
+ });
+});
+
+const mockMixin = {
+ methods: {
+ getCmsContent: jest.fn(),
+ getFooterInfoBoxHeight: jest.fn(() => 50),
+ },
+ computed: {
+ dynamicStrings: jest.fn(() => {
+ return { ROUTER_LINK: "routerLink:" };
+ }),
+ },
+};
+
+function setUpViewPort(height) {
+ Object.defineProperty(global.window, "innerHeight", {
+ writable: true,
+ configurable: true,
+ value: height,
+ });
+
+ Object.defineProperty(window.document.documentElement, "clientHeight", {
+ writable: true,
+ configurable: true,
+ value: height,
+ });
+}
+
+function setupMocks(mountOptionsMockData = {}) {
+ const defaultMountOptions = {
+ propsData: {
+ manualHeadline: "testHeader",
+ manualCopy: "testCopy",
+ },
+ mixins: [mockMixin],
+ };
+ const baseMountOptions = getMountOptions(
+ Object.assign(defaultMountOptions, mountOptionsMockData)
+ );
+ const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
+ return allMountOptions;
+}
diff --git a/src/ux-components/alert/alert.vue b/src/ux-components/alert/alert.vue
new file mode 100644
index 00000000..d0fe33ac
--- /dev/null
+++ b/src/ux-components/alert/alert.vue
@@ -0,0 +1,189 @@
+
+