Skip to content

Commit

Permalink
Fix commenting test
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Apr 13, 2023
1 parent d364cdf commit e5a4e7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"editor.formatOnSave": true,
"cSpell.blockCheckingWhenLineLengthGreaterThan": 150,
"cSpell.words": [
"asyncable",
"Browserslist",
Expand All @@ -14,7 +15,8 @@
"pako",
"Serde",
"serdes",
"tailwindcss"
"tailwindcss",
"uparrow"
],
"vitest.commandLine": "yarn test:unit",
"vitest.enable": true,
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/diagramUpdate.spec.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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}/`);
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/util.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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');
Expand Down

0 comments on commit e5a4e7b

Please sign in to comment.