-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
`); | ||
}); | ||
}); |