UNPKG

@thoughtspot/visual-embed-sdk

Version:
44 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const index_1 = require("../index"); const test_utils_1 = require("../test/test-utils"); const authInstance = tslib_1.__importStar(require("../auth")); const thoughtSpotHost = 'tshost'; const defaultViewConfig = { frameParams: { width: 1280, height: 720, }, }; beforeAll(() => { (0, index_1.init)({ thoughtSpotHost, authType: index_1.AuthType.None, }); spyOn(window, 'alert'); jest.spyOn(authInstance, 'postLoginService').mockResolvedValue(true); }); describe('test view config', () => { beforeEach(() => { document.body.innerHTML = (0, test_utils_1.getDocumentBody)(); }); test('should apply width and height to the iframe', async () => { const width = 800; const height = 600; const searchEmbed = new index_1.SearchEmbed((0, test_utils_1.getRootEl)(), { ...defaultViewConfig, frameParams: { width, height, }, }); searchEmbed.render(); await (0, test_utils_1.executeAfterWait)(() => { const iframe = (0, test_utils_1.getIFrameEl)(); expect(iframe.style.width).toBe(`${width}px`); expect(iframe.style.height).toBe(`${height}px`); }); }); }); //# sourceMappingURL=embed.spec.js.map