Fix commenting test
This commit is contained in:
Vendored
+3
-1
@@ -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,
|
||||
|
||||
@@ -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
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user