Skip to content

Commit f53381d

Browse files
committed
test: live preview error banner should come if there are syntax errors
1 parent 7ec983d commit f53381d

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

test/spec/LiveDevelopmentMultiBrowser-test.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ define(function (require, exports, module) {
2626

2727
const SpecRunnerUtils = require("spec/SpecRunnerUtils"),
2828
KeyEvent = require("utils/KeyEvent"),
29-
StringUtils = require("utils/StringUtils");
29+
StringUtils = require("utils/StringUtils"),
30+
Strings = require("strings");
3031

3132
describe("livepreview:MultiBrowser Live Preview", function () {
3233

@@ -360,6 +361,37 @@ define(function (require, exports, module) {
360361
await endPreviewSession();
361362
}, 30000);
362363

364+
it("should show error banner if there is syntax error in html", async function () {
365+
let savedText,
366+
curDoc;
367+
368+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
369+
"SpecRunnerUtils.openProjectFiles simple1.html");
370+
371+
await waitsForLiveDevelopmentToOpen();
372+
373+
curDoc = DocumentManager.getCurrentDocument();
374+
savedText = curDoc.getText();
375+
// split file in half to and add syntax error then see if error banner shows up
376+
const mid = Math.ceil(savedText.length / 2);
377+
curDoc.setText(savedText.slice(0, mid));
378+
379+
await awaitsFor(
380+
function isBannerVisible() {
381+
return testWindow.$(".live-preview-status-overlay").is(":visible") &&
382+
testWindow.$(".live-preview-status-overlay").text()
383+
.includes(Strings.LIVE_DEV_STATUS_TIP_SYNC_ERROR);
384+
},
385+
"waiting for syntax error banner to appear",
386+
5000,
387+
50
388+
);
389+
390+
curDoc.setText(savedText);
391+
392+
await endPreviewSession();
393+
}, 30000);
394+
363395
it("should make CSS-relative URLs absolute", async function () {
364396
var localText,
365397
browserText,

0 commit comments

Comments
 (0)