From 187fa19a7b708d88a38f53cdeadc9071ff7284af Mon Sep 17 00:00:00 2001 From: Sahir Boghani Date: Thu, 25 Apr 2019 14:02:57 -0700 Subject: [PATCH 1/6] Expose function to style buttons --- src/launchAsync.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/launchAsync.ts b/src/launchAsync.ts index 42311061..adf1189e 100644 --- a/src/launchAsync.ts +++ b/src/launchAsync.ts @@ -126,3 +126,18 @@ export function launchAsync(token: string, content: Content, options?: Options): document.documentElement.style.overflow = 'hidden'; }); } + +/** + * Style the launch buttons with an encoded SVG of the assets\icon.svg + */ +export function styleLaunchButtons(): void { + const buttons: HTMLCollectionOf = document.getElementsByClassName('IRLaunchButton'); + const encodedSvg = `url("data:image/svg+xml,%3Csvg viewBox='0 0 40 37' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg fill-rule='nonzero'%3E%3Cpath d='M37.4,0.9 L37.4,9.6 L35.4,9.6 L35.4,2.9 L24.4,2.9 C22.9,3.3 20,4.5 20,6 L20,17.2 L18,17.2 L18,6 C18,5 15.6,3.6 13.8,2.9 L2,2.9 L2,29 L12.4,29 L12.4,31 L0,31 L0,0.9 L14.1,0.9 L14.3,1 C15,1.2 17.5,2.2 18.9,3.7 C20.5,1.9 23.5,1.1 23.9,1 L24.1,1 L37.4,1 L37.4,0.9 Z' fill='%23000000'%3E%3C/path%3E%3Cpath d='M27.4,37 L25.8,37 L18.4,29.4 L14,29.4 L14,21 L18.4,20.9 L26.1,13 L27.4,13 L27.4,37 Z M16,27.4 L19.2,27.4 L25.3,33.7 L25.3,16.6 L19.2,22.9 L15.9,22.9 L15.9,27.4 L16,27.4 Z' fill='%230197F2'%3E%3C/path%3E%3Cpath d='M31.3,32.7 L29.6,31.7 C29.6,31.7 31.7,28.3 31.7,25.2 C31.7,21.9 29.6,18.5 29.6,18.4 L31.3,17.4 C31.4,17.6 33.7,21.3 33.7,25.2 C33.7,28.8 31.4,32.6 31.3,32.7 Z' fill='%230197F2'%3E%3C/path%3E%3Cpath d='M36.4,36.2 L34.8,35 C34.8,35 38,30.8 38,25.2 C38,19.6 34.8,15.4 34.8,15.4 L36.4,14.2 C36.5,14.4 40,19 40,25.3 C40,31.5 36.5,36 36.4,36.2 Z' fill='%230197F2'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`; + + for (const button of buttons) { + const castedButton = button as HTMLButtonElement; + + castedButton.style.backgroundImage = encodedSvg; + castedButton.style.height = castedButton.style.width = '40px'; + } +} From d2ff2a7fd9231dbb5f1e85dc669d4983998ddfd9 Mon Sep 17 00:00:00 2001 From: Sahir Boghani Date: Fri, 26 Apr 2019 15:00:09 -0700 Subject: [PATCH 2/6] PR feedback --- src/launchAsync.ts | 18 +++++----- tests/launchAsync.test.ts | 69 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/src/launchAsync.ts b/src/launchAsync.ts index adf1189e..0adcac6f 100644 --- a/src/launchAsync.ts +++ b/src/launchAsync.ts @@ -128,16 +128,18 @@ export function launchAsync(token: string, content: Content, options?: Options): } /** - * Style the launch buttons with an encoded SVG of the assets\icon.svg + * Append an of assets/icon.svg to every element with the specified className. Intended to be used with divs to avoid default styles */ -export function styleLaunchButtons(): void { - const buttons: HTMLCollectionOf = document.getElementsByClassName('IRLaunchButton'); - const encodedSvg = `url("data:image/svg+xml,%3Csvg viewBox='0 0 40 37' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg fill-rule='nonzero'%3E%3Cpath d='M37.4,0.9 L37.4,9.6 L35.4,9.6 L35.4,2.9 L24.4,2.9 C22.9,3.3 20,4.5 20,6 L20,17.2 L18,17.2 L18,6 C18,5 15.6,3.6 13.8,2.9 L2,2.9 L2,29 L12.4,29 L12.4,31 L0,31 L0,0.9 L14.1,0.9 L14.3,1 C15,1.2 17.5,2.2 18.9,3.7 C20.5,1.9 23.5,1.1 23.9,1 L24.1,1 L37.4,1 L37.4,0.9 Z' fill='%23000000'%3E%3C/path%3E%3Cpath d='M27.4,37 L25.8,37 L18.4,29.4 L14,29.4 L14,21 L18.4,20.9 L26.1,13 L27.4,13 L27.4,37 Z M16,27.4 L19.2,27.4 L25.3,33.7 L25.3,16.6 L19.2,22.9 L15.9,22.9 L15.9,27.4 L16,27.4 Z' fill='%230197F2'%3E%3C/path%3E%3Cpath d='M31.3,32.7 L29.6,31.7 C29.6,31.7 31.7,28.3 31.7,25.2 C31.7,21.9 29.6,18.5 29.6,18.4 L31.3,17.4 C31.4,17.6 33.7,21.3 33.7,25.2 C33.7,28.8 31.4,32.6 31.3,32.7 Z' fill='%230197F2'%3E%3C/path%3E%3Cpath d='M36.4,36.2 L34.8,35 C34.8,35 38,30.8 38,25.2 C38,19.6 34.8,15.4 34.8,15.4 L36.4,14.2 C36.5,14.4 40,19 40,25.3 C40,31.5 36.5,36 36.4,36.2 Z' fill='%230197F2'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`; +export function styleLaunchDivs(className: string): void { + const launchDivs: HTMLCollectionOf = document.getElementsByClassName(className); + const iconImagePath = '../../assets/icon.svg'; - for (const button of buttons) { - const castedButton = button as HTMLButtonElement; + for (const launchDiv of launchDivs) { + const castedLaunchDiv = launchDiv as HTMLDivElement; + const iconImage: HTMLImageElement = document.createElement('img'); + iconImage.src = iconImagePath; - castedButton.style.backgroundImage = encodedSvg; - castedButton.style.height = castedButton.style.width = '40px'; + castedLaunchDiv.style.height = castedLaunchDiv.style.width = '20px'; + castedLaunchDiv.appendChild(iconImage); } } diff --git a/tests/launchAsync.test.ts b/tests/launchAsync.test.ts index 73b256f3..db6c1570 100644 --- a/tests/launchAsync.test.ts +++ b/tests/launchAsync.test.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { launchAsync } from '../src/launchAsync'; +import { launchAsync, styleLaunchDivs } from '../src/launchAsync'; import { Content } from '../src/content'; import { Options } from '../src/options'; @@ -106,4 +106,71 @@ describe('launchAsync tests', () => { expect(reason.code).toBe('Timeout'); } }); +}); + +describe('styleLaunchDivs', () => { + it('styles a single div as expected', () => { + const numImgsBeforeStyling = document.getElementsByTagName('img').length; + const newDiv: HTMLDivElement = document.createElement('div'); + newDiv.className = 'IRLaunchDiv'; + document.body.appendChild(newDiv); + + expect(numImgsBeforeStyling).toBe(0); + + styleLaunchDivs('IRLaunchDiv'); + const numImgsAfterStyling = document.getElementsByTagName('img').length; + + expect(numImgsAfterStyling).toBe(1); + + // Cleanup the DOM + newDiv.remove(); + }); + + it('styles multiple divs as expected', () => { + const numImgsBeforeStyling = document.getElementsByTagName('img').length; + const newDiv1: HTMLDivElement = document.createElement('div'); + const newDiv2: HTMLDivElement = document.createElement('div'); + const newDiv3: HTMLDivElement = document.createElement('div'); + newDiv1.className = newDiv2.className = newDiv3.className = 'IRLaunchDiv'; + + document.body.appendChild(newDiv1); + document.body.appendChild(newDiv2); + document.body.appendChild(newDiv3); + + expect(numImgsBeforeStyling).toBe(0); + + styleLaunchDivs('IRLaunchDiv'); + + const numImgsAfterStyling = document.getElementsByTagName('img').length; + + expect(numImgsAfterStyling).toBe(3); + + // Cleanup the DOM + newDiv1.remove(); + newDiv2.remove(); + newDiv3.remove(); + }); + + it('does nothing for incorrect classnames', () => { + const numImgsBeforeStyling = document.getElementsByTagName('img').length; + const newDiv1: HTMLDivElement = document.createElement('div'); + const newDiv2: HTMLDivElement = document.createElement('div'); + newDiv1.className = 'IRLaunchDivv'; + newDiv2.className = 'IRLaunchhDiv'; + + document.body.appendChild(newDiv1); + document.body.appendChild(newDiv2); + + expect(numImgsBeforeStyling).toBe(0); + + styleLaunchDivs('IRLaunchDiv'); + + const numImgsAfterStyling = document.getElementsByTagName('img').length; + + expect(numImgsAfterStyling).toBe(0); + + // Cleanup the DOM + newDiv1.remove(); + newDiv2.remove(); + }); }); \ No newline at end of file From cee01e058b973e92c2ff8bc3b859884b89ec9ea0 Mon Sep 17 00:00:00 2001 From: Sahir Boghani Date: Fri, 26 Apr 2019 15:34:45 -0700 Subject: [PATCH 3/6] Alt text for img --- src/launchAsync.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/launchAsync.ts b/src/launchAsync.ts index 3339047c..9f68c655 100644 --- a/src/launchAsync.ts +++ b/src/launchAsync.ts @@ -146,6 +146,7 @@ export function styleLaunchDivs(className: string): void { const castedLaunchDiv = launchDiv as HTMLDivElement; const iconImage: HTMLImageElement = document.createElement('img'); iconImage.src = iconImagePath; + iconImage.alt = 'Immersive Reader'; castedLaunchDiv.style.height = castedLaunchDiv.style.width = '20px'; castedLaunchDiv.appendChild(iconImage); From 27f04db122a6b104ccee1fd26a0429fcdb5ccdcd Mon Sep 17 00:00:00 2001 From: Sahir Boghani Date: Thu, 2 May 2019 11:09:59 -0700 Subject: [PATCH 4/6] Use CDN path for icon --- src/launchAsync.ts | 308 ++++++++++++++++++++++----------------------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/src/launchAsync.ts b/src/launchAsync.ts index 9f68c655..81a003b1 100644 --- a/src/launchAsync.ts +++ b/src/launchAsync.ts @@ -1,154 +1,154 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -import { Content } from './content'; -import { Options } from './options'; -import { Error } from './error'; - -type Message = { - cogSvcsAccessToken: string; - request: Content; - launchToPostMessageSentDurationInMs: number; -}; - -/** - * Launch the Immersive Reader within an iframe. - * @param token The authentication token returned from the Cognitive Services issueToken API. - * @param content The content that should be shown in the Immersive Reader. - * @param options Options for configuring the look and feel of the Immersive Reader. - * @return A promise that resolves when the Immersive Reader is launched. The promise resolves with the div that contains an iframe which contains the Immersive Reader. - */ -export function launchAsync(token: string, content: Content, options?: Options): Promise { - return new Promise((resolve, reject: (reason: Error) => void): void => { - if (!token) { - reject({ code: 'BadArgument', message: 'Token must not be null' }); - return; - } - - if (!content) { - reject({ code: 'BadArgument', message: 'Content must not be null' }); - return; - } - - if (!content.chunks) { - reject({ code: 'BadArgument', message: 'Chunks must not be null' }); - return; - } - - if (!content.chunks.length) { - reject({ code: 'BadArgument', message: 'Chunks must not be empty' }); - return; - } - - const startTime = Date.now(); - options = { - uiZIndex: 1000, - timeout: 15000, // Default to 15 seconds - useWebview: false, - ...options - }; - - // Ensure that we were given a number for the UI z-index - if (!options.uiZIndex || typeof options.uiZIndex !== 'number') { - options.uiZIndex = 1000; - } - - let timeoutId: number | null = null; - const iframeContainer: HTMLDivElement = document.createElement('div'); - const iframe: HTMLIFrameElement = options.useWebview ? document.createElement('webview') : document.createElement('iframe'); - const bodyOverflow: string | null = document.body.style.overflow; - const htmlOverflow: string | null = document.documentElement.style.overflow; - - const resetTimeout = (): void => { - if (timeoutId) { - window.clearTimeout(timeoutId); - timeoutId = null; - } - }; - - const reset = (): void => { - // Remove container along with the iframe inside of it - if (document.body.contains(iframeContainer)) { - document.body.removeChild(iframeContainer); - } - - // Clear the timeout timer - resetTimeout(); - - // Re-enable scrolling - document.body.style.overflow = bodyOverflow; - document.documentElement.style.overflow = htmlOverflow; - }; - - // Reset variables - reset(); - - const messageHandler = (e: any): void => { - if (!e || !e.data) { return; } - - if (e.data === 'ImmersiveReader-Exit') { - reset(); - window.removeEventListener('message', messageHandler); - } else if (e.data === 'ImmersiveReader-ReadyForContent') { - resetTimeout(); - const message: Message = { - cogSvcsAccessToken: token, - request: content, - launchToPostMessageSentDurationInMs: Date.now() - startTime - }; - iframe.contentWindow!.postMessage(JSON.stringify({ messageType: 'Content', messageValue: message }), '*'); - resolve(iframeContainer); - } - }; - window.addEventListener('message', messageHandler); - - // Reject the promise if the Immersive Reader page fails to load. - timeoutId = window.setTimeout((): void => { - reject({ code: 'Timeout', message: `Page failed to load after timeout (${options.timeout} ms)` }); - }, options.timeout); - - // Create and style iframe - iframe.setAttribute('allowfullscreen', ''); - iframe.style.cssText = 'position: static; width: 100vw; height: 100vh; left: 0; top: 0; border-width: 0'; - - // Send an initial message to the webview so it has a reference to this parent window - if (options.useWebview) { - iframe.addEventListener('loadstop', () => { - iframe.contentWindow.postMessage(JSON.stringify({ messageType: 'WebviewHost' }), '*'); - }); - } - - let src = 'https://learningtools.onenote.com/learningtoolsapp/cognitive/reader?exitCallback=ImmersiveReader-Exit'; - if (options.uiLang) { - src += '&omkt=' + options.uiLang; - } - iframe.src = src; - - iframeContainer.style.cssText = `position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; border-width: 0; -webkit-perspective: 1px; z-index: ${options.uiZIndex}; background: white; overflow: hidden`; - - iframeContainer.appendChild(iframe); - document.body.append(iframeContainer); - - // Disable body scrolling - document.body.style.overflow = 'hidden'; - document.documentElement.style.overflow = 'hidden'; - }); -} - -/** - * Append an of assets/icon.svg to every element with the specified className. Intended to be used with divs to avoid default styles - */ -export function styleLaunchDivs(className: string): void { - const launchDivs: HTMLCollectionOf = document.getElementsByClassName(className); - const iconImagePath = '../../assets/icon.svg'; - - for (const launchDiv of launchDivs) { - const castedLaunchDiv = launchDiv as HTMLDivElement; - const iconImage: HTMLImageElement = document.createElement('img'); - iconImage.src = iconImagePath; - iconImage.alt = 'Immersive Reader'; - - castedLaunchDiv.style.height = castedLaunchDiv.style.width = '20px'; - castedLaunchDiv.appendChild(iconImage); - } -} +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import { Content } from './content'; +import { Options } from './options'; +import { Error } from './error'; + +type Message = { + cogSvcsAccessToken: string; + request: Content; + launchToPostMessageSentDurationInMs: number; +}; + +/** + * Launch the Immersive Reader within an iframe. + * @param token The authentication token returned from the Cognitive Services issueToken API. + * @param content The content that should be shown in the Immersive Reader. + * @param options Options for configuring the look and feel of the Immersive Reader. + * @return A promise that resolves when the Immersive Reader is launched. The promise resolves with the div that contains an iframe which contains the Immersive Reader. + */ +export function launchAsync(token: string, content: Content, options?: Options): Promise { + return new Promise((resolve, reject: (reason: Error) => void): void => { + if (!token) { + reject({ code: 'BadArgument', message: 'Token must not be null' }); + return; + } + + if (!content) { + reject({ code: 'BadArgument', message: 'Content must not be null' }); + return; + } + + if (!content.chunks) { + reject({ code: 'BadArgument', message: 'Chunks must not be null' }); + return; + } + + if (!content.chunks.length) { + reject({ code: 'BadArgument', message: 'Chunks must not be empty' }); + return; + } + + const startTime = Date.now(); + options = { + uiZIndex: 1000, + timeout: 15000, // Default to 15 seconds + useWebview: false, + ...options + }; + + // Ensure that we were given a number for the UI z-index + if (!options.uiZIndex || typeof options.uiZIndex !== 'number') { + options.uiZIndex = 1000; + } + + let timeoutId: number | null = null; + const iframeContainer: HTMLDivElement = document.createElement('div'); + const iframe: HTMLIFrameElement = options.useWebview ? document.createElement('webview') : document.createElement('iframe'); + const bodyOverflow: string | null = document.body.style.overflow; + const htmlOverflow: string | null = document.documentElement.style.overflow; + + const resetTimeout = (): void => { + if (timeoutId) { + window.clearTimeout(timeoutId); + timeoutId = null; + } + }; + + const reset = (): void => { + // Remove container along with the iframe inside of it + if (document.body.contains(iframeContainer)) { + document.body.removeChild(iframeContainer); + } + + // Clear the timeout timer + resetTimeout(); + + // Re-enable scrolling + document.body.style.overflow = bodyOverflow; + document.documentElement.style.overflow = htmlOverflow; + }; + + // Reset variables + reset(); + + const messageHandler = (e: any): void => { + if (!e || !e.data) { return; } + + if (e.data === 'ImmersiveReader-Exit') { + reset(); + window.removeEventListener('message', messageHandler); + } else if (e.data === 'ImmersiveReader-ReadyForContent') { + resetTimeout(); + const message: Message = { + cogSvcsAccessToken: token, + request: content, + launchToPostMessageSentDurationInMs: Date.now() - startTime + }; + iframe.contentWindow!.postMessage(JSON.stringify({ messageType: 'Content', messageValue: message }), '*'); + resolve(iframeContainer); + } + }; + window.addEventListener('message', messageHandler); + + // Reject the promise if the Immersive Reader page fails to load. + timeoutId = window.setTimeout((): void => { + reject({ code: 'Timeout', message: `Page failed to load after timeout (${options.timeout} ms)` }); + }, options.timeout); + + // Create and style iframe + iframe.setAttribute('allowfullscreen', ''); + iframe.style.cssText = 'position: static; width: 100vw; height: 100vh; left: 0; top: 0; border-width: 0'; + + // Send an initial message to the webview so it has a reference to this parent window + if (options.useWebview) { + iframe.addEventListener('loadstop', () => { + iframe.contentWindow.postMessage(JSON.stringify({ messageType: 'WebviewHost' }), '*'); + }); + } + + let src = 'https://learningtools.onenote.com/learningtoolsapp/cognitive/reader?exitCallback=ImmersiveReader-Exit'; + if (options.uiLang) { + src += '&omkt=' + options.uiLang; + } + iframe.src = src; + + iframeContainer.style.cssText = `position: fixed; width: 100vw; height: 100vh; left: 0; top: 0; border-width: 0; -webkit-perspective: 1px; z-index: ${options.uiZIndex}; background: white; overflow: hidden`; + + iframeContainer.appendChild(iframe); + document.body.append(iframeContainer); + + // Disable body scrolling + document.body.style.overflow = 'hidden'; + document.documentElement.style.overflow = 'hidden'; + }); +} + +/** + * Append an of assets/icon.svg to every element with the specified className. Intended to be used with divs to avoid default styles + */ +export function styleLaunchDivs(className: string): void { + const launchDivs: HTMLCollectionOf = document.getElementsByClassName(className); + const iconImagePath: string = 'https://contentstorage.onenote.office.net/onenoteltir/permanent-static-resources/immersive-reader-icon.svg'; + + for (const launchDiv of launchDivs) { + const castedLaunchDiv = launchDiv as HTMLDivElement; + const iconImage: HTMLImageElement = document.createElement('img'); + iconImage.src = iconImagePath; + iconImage.alt = 'Immersive Reader'; + + castedLaunchDiv.style.height = castedLaunchDiv.style.width = '20px'; + castedLaunchDiv.appendChild(iconImage); + } +} From 71f9f920c82538a8e3fe3122340071bf8703c720 Mon Sep 17 00:00:00 2001 From: Sahir Boghani Date: Thu, 2 May 2019 11:35:36 -0700 Subject: [PATCH 5/6] PR feedback - rename funtion --- src/launchAsync.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launchAsync.ts b/src/launchAsync.ts index 81a003b1..673e8172 100644 --- a/src/launchAsync.ts +++ b/src/launchAsync.ts @@ -136,9 +136,9 @@ export function launchAsync(token: string, content: Content, options?: Options): } /** - * Append an of assets/icon.svg to every element with the specified className. Intended to be used with divs to avoid default styles + * Append an of assets/icon.svg to every element with the specified className. Intended to be used with empty divs to avoid default styles */ -export function styleLaunchDivs(className: string): void { +export function renderLaunchButtons(className: string): void { const launchDivs: HTMLCollectionOf = document.getElementsByClassName(className); const iconImagePath: string = 'https://contentstorage.onenote.office.net/onenoteltir/permanent-static-resources/immersive-reader-icon.svg'; From d47f0e54fc8b5dcf29b32203b1238b81aa193569 Mon Sep 17 00:00:00 2001 From: Sahir Boghani Date: Thu, 2 May 2019 11:43:39 -0700 Subject: [PATCH 6/6] Fix test file, remove english alt text --- src/launchAsync.ts | 1 - tests/launchAsync.test.ts | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/launchAsync.ts b/src/launchAsync.ts index 673e8172..3d8bb354 100644 --- a/src/launchAsync.ts +++ b/src/launchAsync.ts @@ -146,7 +146,6 @@ export function renderLaunchButtons(className: string): void { const castedLaunchDiv = launchDiv as HTMLDivElement; const iconImage: HTMLImageElement = document.createElement('img'); iconImage.src = iconImagePath; - iconImage.alt = 'Immersive Reader'; castedLaunchDiv.style.height = castedLaunchDiv.style.width = '20px'; castedLaunchDiv.appendChild(iconImage); diff --git a/tests/launchAsync.test.ts b/tests/launchAsync.test.ts index db6c1570..4c4bfb50 100644 --- a/tests/launchAsync.test.ts +++ b/tests/launchAsync.test.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { launchAsync, styleLaunchDivs } from '../src/launchAsync'; +import { launchAsync, renderLaunchButtons } from '../src/launchAsync'; import { Content } from '../src/content'; import { Options } from '../src/options'; @@ -108,7 +108,7 @@ describe('launchAsync tests', () => { }); }); -describe('styleLaunchDivs', () => { +describe('renderLaunchButtons', () => { it('styles a single div as expected', () => { const numImgsBeforeStyling = document.getElementsByTagName('img').length; const newDiv: HTMLDivElement = document.createElement('div'); @@ -117,7 +117,7 @@ describe('styleLaunchDivs', () => { expect(numImgsBeforeStyling).toBe(0); - styleLaunchDivs('IRLaunchDiv'); + renderLaunchButtons('IRLaunchDiv'); const numImgsAfterStyling = document.getElementsByTagName('img').length; expect(numImgsAfterStyling).toBe(1); @@ -139,7 +139,7 @@ describe('styleLaunchDivs', () => { expect(numImgsBeforeStyling).toBe(0); - styleLaunchDivs('IRLaunchDiv'); + renderLaunchButtons('IRLaunchDiv'); const numImgsAfterStyling = document.getElementsByTagName('img').length; @@ -163,7 +163,7 @@ describe('styleLaunchDivs', () => { expect(numImgsBeforeStyling).toBe(0); - styleLaunchDivs('IRLaunchDiv'); + renderLaunchButtons('IRLaunchDiv'); const numImgsAfterStyling = document.getElementsByTagName('img').length;