Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
caridy committed Mar 17, 2020
1 parent 527ad73 commit 1259e38
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/membrane/document-all.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import createSecureEnvironment from '../../lib/browser-realm.js';

describe('document.all', () => {
it('should change the value of its yellow typeof from "undefined" to "object"', function() {
// expect.assertions(2);
const evalScript = createSecureEnvironment();
expect(typeof document.all).toBe("undefined");
evalScript(`
// observable difference between a regular dom and a sandboxed dom
expect(typeof document.all).toBe("object");
`);
});
it('should work throughout the membrane', function() {
// expect.assertions(3);
const evalScript = createSecureEnvironment();
evalScript(`
expect(document.all.length > 1).toBeTrue();
expect(document.all[0].ownerDocument).toBe(document); // comparison in red
expect(document.all[0].ownerDocument === document).toBeTrue(); // comparison in yellow
`);
});
});

0 comments on commit 1259e38

Please sign in to comment.