Skip to content

Commit

Permalink
Fix tests after boolean attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Apr 24, 2019
1 parent c05d758 commit 263cffc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/embed/src/setups/loadAsset.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ describe('Load a JavaScript file', () => {
document.head.querySelector('script').dispatchEvent(event);

expect(loadTask).rejects.toBe(event);
expect(document.head).toHaveProperty('outerHTML', '<head><script async="true" crossorigin="anonymous" src="index.js"></script></head>');
expect(document.head).toHaveProperty('outerHTML', '<head><script async="" crossorigin="anonymous" src="index.js"></script></head>');
});

test('succeeded', async () => {
document.head.querySelector('script').dispatchEvent(new Event('load'));

await loadTask;

expect(document.head).toHaveProperty('outerHTML', '<head><script async="true" crossorigin="anonymous" src="index.js"></script></head>');
expect(document.head).toHaveProperty('outerHTML', '<head><script async="" crossorigin="anonymous" src="index.js"></script></head>');
});
});

test('with subresource integrity', async () => {
loadTask = loadAsset(['index.js', 'sha384-a1b2c3d']);

document.head.querySelector('script').dispatchEvent(new Event('load'));
expect(document.head).toHaveProperty('outerHTML', '<head><script async="true" crossorigin="anonymous" integrity="sha384-a1b2c3d" src="index.js"></script></head>');
expect(document.head).toHaveProperty('outerHTML', '<head><script async="" crossorigin="anonymous" integrity="sha384-a1b2c3d" src="index.js"></script></head>');

await loadTask;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/src/setups/version3.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('Load Web Chat v3 without a speech token', async () => {

const { version } = await setupTask;

expect(document.head).toHaveProperty('outerHTML', '<head><link crossorigin="anonymous" href="botchat.css" integrity="sha384-a1b2c3d" rel="stylesheet"><script async="true" crossorigin="anonymous" integrity="sha384-a1b2c3d" src="botchat.js"></script></head>');
expect(document.head).toHaveProperty('outerHTML', '<head><link crossorigin="anonymous" href="botchat.css" integrity="sha384-a1b2c3d" rel="stylesheet"><script async="" crossorigin="anonymous" integrity="sha384-a1b2c3d" src="botchat.js"></script></head>');
expect(document.body).toHaveProperty('outerHTML', '<body><div><div id="webchat"></div></div></body>');
expect(window.BotChat.App).toHaveBeenCalledTimes(1);
expect(version).toBe('3');
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/src/setups/version4.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('Load Web Chat v4', async () => {
username: 'William'
});

expect(document.head).toHaveProperty('outerHTML', '<head><script async="true" crossorigin="anonymous" integrity="sha384-a1b2c3d" src="webchat.js"></script></head>');
expect(document.head).toHaveProperty('outerHTML', '<head><script async="" crossorigin="anonymous" integrity="sha384-a1b2c3d" src="webchat.js"></script></head>');
[].forEach.call(document.head.querySelectorAll('script'), target => target.dispatchEvent(new Event('load')));

const { version } = await setupTask;
Expand Down

0 comments on commit 263cffc

Please sign in to comment.