-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codeviewer): make CM view read-only (#390)
* fix(codeviewer): make CM view read-only * test: content editable
- Loading branch information
Showing
5 changed files
with
27 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import "cypress-real-events/support"; | ||
|
||
describe("CodeViewer", () => { | ||
it("should not be editable", () => { | ||
cy.viewport(600, 1000).visit( | ||
`/iframe.html?id=components-code-viewer--component` | ||
); | ||
|
||
cy.get(".cm-content").type("{selectall}").type("{backspace}"); | ||
|
||
cy.get(".cm-content").snapshot(); | ||
cy.get(".cm-content").should("have.attr", "contenteditable", "false"); | ||
}); | ||
|
||
it("should not be able to cut the content", () => { | ||
cy.viewport(600, 1000).visit( | ||
`/iframe.html?id=components-code-viewer--component` | ||
); | ||
|
||
cy.get(".cm-content").type("{selectall}").type("{meta}x"); | ||
// Force select and Command+X: it should fail for non-ready-only component | ||
cy.get(".cm-content").trigger("mousedown").realPress(["Meta", "x"]); | ||
|
||
// content should still be there | ||
cy.get(".cm-content").snapshot(); | ||
}); | ||
}); |
Oops, something went wrong.