Skip to content

Commit

Permalink
test correctly handle invalid layer
Browse files Browse the repository at this point in the history
  • Loading branch information
dqnykamp committed Mar 21, 2023
1 parent d66ac3a commit 770f551
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions cypress/e2e/DoenetML/tagSpecific/point.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14336,4 +14336,41 @@ describe('Point Tag Tests', function () {

});

it('handle invalid layer', () => {
cy.window().then(async (win) => {
win.postMessage({
doenetML: `
<text>a</text>
<graph>
<point name="P" layer="$l">(3,4)</point>
</graph>
<mathinput name="l" />
<number copysource="P.layer" name="l2" />
`}, "*");
});


cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load

cy.get("#\\/l2").should('have.text', '0')

cy.window().then(async (win) => {
let stateVariables = await win.returnAllStateVariables1();
expect(stateVariables["/P"].stateValues.layer).eq(0);

})


cy.get("#\\/l textarea").type("1{enter}", { force: true });
cy.get("#\\/l2").should('have.text', '1')


cy.window().then(async (win) => {
let stateVariables = await win.returnAllStateVariables1();
expect(stateVariables["/P"].stateValues.layer).eq(1);

})

});

})

0 comments on commit 770f551

Please sign in to comment.