Fix commenting test

This commit is contained in:
Sidharth Vinod
2023-04-13 16:31:02 +05:30
parent d364cdfd83
commit e5a4e7b997
3 changed files with 11 additions and 7 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
{
"editor.formatOnSave": true,
"cSpell.blockCheckingWhenLineLengthGreaterThan": 150,
"cSpell.words": [
"asyncable",
"Browserslist",
@@ -14,7 +15,8 @@
"pako",
"Serde",
"serdes",
"tailwindcss"
"tailwindcss",
"uparrow"
],
"vitest.commandLine": "yarn test:unit",
"vitest.enable": true,
+4 -2
View File
@@ -1,9 +1,10 @@
import { typeInEditor, cmd } from './util';
import { typeInEditor, cmd, getEditor } from './util';
describe('Auto sync tests', () => {
beforeEach(() => {
cy.clearLocalStorage();
cy.visit('/');
cy.url().should('contain', '/edit#pako');
});
it('should dim diagram when code is edited', () => {
@@ -49,7 +50,8 @@ describe('Auto sync tests', () => {
});
it('supports commenting code out/in', () => {
typeInEditor(`{uparrow}${cmd}/`, { bottom: true, newline: false });
getEditor().contains('Car').click();
getEditor().get('textarea').type(`${cmd}/`);
cy.get('#view').contains('Car').should('not.exist');
typeInEditor(`{uparrow}${cmd}/`);
+4 -4
View File
@@ -1,5 +1,5 @@
export const cmd = `{${Cypress.platform === 'darwin' ? 'meta' : 'ctrl'}}`;
const editor = () => cy.get('#editor textarea:first');
export const getEditor = () => cy.get('#editor textarea:first');
interface EditorOptions {
bottom?: boolean;
@@ -11,12 +11,12 @@ export const typeInEditor = (
{ bottom = true, newline = false }: EditorOptions = {}
) => {
if (bottom) {
editor().type('{pageDown}');
getEditor().type('{pageDown}');
}
if (newline) {
editor().type('{enter}');
getEditor().type('{enter}');
}
editor().type(text);
getEditor().type(text);
};
const downloadsFolder = Cypress.config('downloadsFolder');