Script Environment
JS-based DOM mocks
Ordinary JavaScript
Test Environment
Jasmine 2.8.0
Run the test
Object graphs
Graph Name
Symbol?
Callback Name
Commands
wet
No
withWetDoc
dry
No
withDryDoc
⇧
⇩
X
/* var Mocks = { wet: { doc: the wet document, Node: Node.prototype, Element: Element.prototype, }, dry: { doc: Dry(Mocks.wet.doc), Node: Dry(Mocks.wet.Node), Element: Dry(Mocks.wet.Element), }, membrane: the membrane }; */ const mockOptions = { wetHandlerCreated: function(wetHandler, Mocks) { /* called after the membrane's wet object graph is created, but before the wet objects are added to Mocks. */ }, dryHandlerCreated: function(dryHandler, Mocks) { /* called after the membrane's dry object graph is created, but before the dry objects are added to Mocks. */ }, /* postMembrane: function(Mocks, ...customGraphNames) { // called after Mocks is fully built out but before returning from // the buildMembrane() invocation. let membrane = Mocks.membrane; } */ };
function defineMocksTests(buildMembrane, withWetDoc, withDryDoc) { describe("A document has node type 9", function() { beforeEach(buildMembrane); it("in the wet graph.", function() { withWetDoc(function(document) { expect(document.nodeType).toBe(9); }); }); it("in the dry graph.", function() { withDryDoc(function(document) { expect(document.nodeType).toBe(9); }); }); }); };
Freeform JavaScripts
Source code
Commands