Skip to content
Browse files

added test for codemirror 577 fix/workaround

  • Loading branch information...
1 parent c0c8cce commit fcb39bac0c5b55ba66b0aac6ceb1521e9527887e @toolness toolness committed
View
8 test/codemirror-577/original.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<!--
+Here is a comment.
+-->
+
+<html>
+</body>
+</html>
View
6 test/codemirror-577/replacer.html
@@ -0,0 +1,6 @@
+<html>
+ <head>
+ </head>
+ <body>
+ </body>
+</html>
View
28 test/codemirror-577/test-codemirror-577.js
@@ -0,0 +1,28 @@
+"use strict";
+
+require([
+ "codemirror",
+ "text!test/codemirror-577/original.html",
+ "text!test/codemirror-577/replacer.html"
+], function(CodeMirror, original, replacer) {
+ module("Codemirror issue 577");
+
+ // Test to ensure that this bug is fixed or worked around:
+ // https://github.com/marijnh/CodeMirror2/issues/577
+ test("undo() doesn't throw", function() {
+ var div = $("<div></div>").appendTo("body");
+ var editor = CodeMirror(div[0], {
+ mode: 'text/plain',
+ tabMode: 'indent'
+ });
+ try {
+ editor.setValue(original);
+ editor.clearHistory();
+ editor.setValue(replacer);
+ editor.undo();
+ ok(true, "undo() didn't throw!");
+ } finally {
+ div.remove();
+ }
+ });
+});
View
1 test/index.html
@@ -50,6 +50,7 @@ <h2 id="qunit-userAgent"></h2>
"test/test-mark-tracker",
"test/test-live-preview",
"test/publisher/test-publisher",
+ "test/codemirror-577/test-codemirror-577",
"test/preview-to-editor-mapping/test-preview-to-editor-mapping"
], function() {
if (QUnit.config.blocking)

0 comments on commit fcb39ba

Please sign in to comment.
Something went wrong with that request. Please try again.