import { selectors } from '../../../../support/selectors';
const location =
'/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements';
describe('Challenge with editor', function () {
it('the shortcut "Ctrl + S" saves the code', () => {
cy.visit(location);
// reloading without saving
const editorContents = `
Hello
`;
cy.get(selectors.class.reactMonacoEditor, { timeout: 10000 })
.as('editor')
.contains(editorContents);
cy.get('@editor').click().focused().type(`{movetoend}Hello World
`);
cy.reload();
cy.get('@editor').contains(editorContents);
// reloading after saving
cy.get('@editor')
.click()
.focused()
.type(`{movetoend}Hello World
{ctrl+s}`);
cy.contains("Saved! Your code was saved to your browser's local storage.");
cy.reload();
cy.get('@editor').contains('Hello
Hello World
');
});
});