-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reset code to worksheet's default (#1445)
* fix: reset code to worksheet's default added a confirm dialog as well * test reset code with confirmation
- Loading branch information
1 parent
60467bf
commit 2ce3a68
Showing
14 changed files
with
136 additions
and
84 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
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
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 |
---|---|---|
@@ -1,45 +1,45 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: ['standard', 'standard-react', 'plugin:cypress/recommended'], | ||
extends: ['standard', 'standard-react', 'plugin:cypress/recommended', 'prettier'], | ||
plugins: ['@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
}, | ||
env: { | ||
browser: true, | ||
'cypress/globals': true | ||
'cypress/globals': true, | ||
}, | ||
globals: { | ||
pyodide: 'readonly', | ||
languagePluginLoader: 'readonly' | ||
languagePluginLoader: 'readonly', | ||
}, | ||
rules: { | ||
'react/jsx-handler-names': 'off', | ||
'react/jsx-pascal-case': [ | ||
'error', | ||
{ | ||
allowAllCaps: true | ||
} | ||
allowAllCaps: true, | ||
}, | ||
], | ||
'@typescript-eslint/member-delimiter-style': [ | ||
'error', | ||
{ | ||
multiline: { | ||
delimiter: 'none' | ||
} | ||
} | ||
delimiter: 'none', | ||
}, | ||
}, | ||
], | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
args: 'none' | ||
} | ||
args: 'none', | ||
}, | ||
], | ||
'no-console': [ | ||
'error', | ||
{ | ||
allow: ['warn', 'error'] | ||
} | ||
] | ||
} | ||
allow: ['warn', 'error'], | ||
}, | ||
], | ||
}, | ||
} |
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,33 @@ | ||
const avatarCode = { | ||
code: `current code`, | ||
starterCode: `starter code`, | ||
} | ||
|
||
describe('User', () => { | ||
before(() => { | ||
cy.login() | ||
cy.addTestGame() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.login() | ||
}) | ||
|
||
it('resets their code to the default one in the Worksheet if they click on Reset Code and confirm', () => { | ||
cy.loadGameWithAvatarCode(avatarCode) | ||
cy.on('window:confirm', () => true) | ||
cy.get('button').contains('Reset code').click() | ||
cy.window() | ||
.then((win) => win.ace.edit('ace_editor').getValue()) | ||
.should('eq', avatarCode.starterCode) | ||
}) | ||
|
||
it('does not reset their code to the default one in the Worksheet if they click on Reset Code and not confirm', () => { | ||
cy.loadGameWithAvatarCode(avatarCode) | ||
cy.on('window:confirm', () => false) | ||
cy.get('button').contains('Reset code').click() | ||
cy.window() | ||
.then((win) => win.ace.edit('ace_editor').getValue()) | ||
.should('eq', avatarCode.code) | ||
}) | ||
}) |
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
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
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
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
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
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
Oops, something went wrong.