forked from flowkey/flowkey-embed-gatget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgadget_spec.js
32 lines (26 loc) · 1.34 KB
/
gadget_spec.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
/* global describe, it, expect, educreationsGadget */
(function() {
describe('educreationsGadget', function() {
it('shows "Please specify the embed code" if no embed code is given', function(done) {
window.postMessage({event: 'attributesChanged', data: {}}, '*');
setTimeout(function() {
chai.expect(document.body.textContent).to.contain("Please specify the embed code");
done();
}, 100);
});
it('embeds educreations embed codes', function(done) {
window.postMessage({event: 'attributesChanged', data: {embedCode: "<iframe width=\"480\" height=\"300\" src=\"https://www.educreations.com/lesson/embed/444280/\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>"}}, '*');
setTimeout(function() {
chai.expect(document.body.innerHTML).to.contain("<iframe");
done();
}, 100);
});
it('doesnt embed other embed codes', function(done) {
window.postMessage({event: 'attributesChanged', data: {embedCode: "<iframe width=\"480\" height=\"300\" src=\"https://www.foo.com/444280/\" frameborder=\"0\" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>"}}, '*');
setTimeout(function() {
chai.expect(document.body.textContent).to.contain("Please specify the embed code");
done();
}, 100);
});
});
})();