forked from microsoft/PowerBI-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembed.spec.js
More file actions
63 lines (50 loc) · 1.96 KB
/
Copy pathembed.spec.js
File metadata and controls
63 lines (50 loc) · 1.96 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(function () {
'use strict';
describe('embed', function () {
var container = null;
var iframe = null;
beforeEach(function () {
container = $('<div powerbi-embed="https://app.powerbi.com/reportEmbed?reportId=ABC123" powerbi-report></div>')
.appendTo('#powerbi-fixture');
window.powerbi.embed(container[0]);
iframe = container.find('iframe');
});
beforeAll(function () {
window.powerbi.accessToken = 'ABC123';
$('<div id="powerbi-fixture"></div>').appendTo(document.body);
});
afterAll(function () {
$('#powerbi-fixture').remove();
});
afterEach(function () {
$('#powerbi-fixture').empty();
});
describe('iframe', function () {
it('has a src', function () {
expect(iframe.attr('src').length).toBeGreaterThan(0);
});
it('disables scrollbars by default', function () {
expect(iframe.attr('scrolling')).toEqual('no');
});
it('sets width/height to 100%', function () {
expect(iframe[0].style.width).toEqual('100%');
expect(iframe[0].style.height).toEqual('100%');
});
});
describe('fullscreen', function () {
it('sets the iframe as the fullscreen element', function () {
var report = window.powerbi.embed(container[0]);
report.fullscreen();
expect(document.webkitFullscreenElement === iframe);
});
});
describe('exitFullscreen', function () {
it('clears the iframe fullscreen element', function () {
var report = window.powerbi.embed(container[0]);
report.fullscreen();
report.exitFullscreen();
expect(document.webkitFullscreenElement !== iframe);
});
});
});
} ());