-
Notifications
You must be signed in to change notification settings - Fork 1
/
import-success.fixme.js
executable file
·41 lines (33 loc) · 1.41 KB
/
import-success.fixme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
export default ({ test, assert }) => ({ setup }) => {
test('import success', async () => {
const { compose, helpers, window } = setup();
const { components } = compose({
overrides: {
services: {
gravatar: {
fetchProfileAsync: () => Promise.resolve({ displayName: 'foo' }),
fetchImageAsync: () => Promise.resolve(new window.Blob(['BYTES'], { type: 'image/jpg' }))
}
}
}
});
const $gravatarModal = components.modals.gravatar();
const $freetextField = $gravatarModal.querySelector('.freetext');
const $importButton = $gravatarModal.querySelector('.import');
const $tagList = components.tagList.container();
const assertGravatarModalVisible = helpers.assertBoolClass(assert, $gravatarModal, 'visible');
$freetextField.value = 'foo@bar.com';
helpers.dispatchEvent('input', $freetextField);
await helpers.onTagListMutation(
$tagList,
() => {
helpers.dispatchEvent('click', $importButton);
},
async tag1 => {
assert.equal(tag1.getTagName(), 'Foo');
assert.equal(await tag1.getImage(), 'url(data:image/jpg;base64,QllURVM=)');
assertGravatarModalVisible(false);
}
);
});
};