Skip to content

Commit f86ee3e

Browse files
committed
test(livepreview): add test for play button and mode dropdown hidden on markdown files
1 parent 8d352b9 commit f86ee3e

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

test/spec/LiveDevelopmentMultiBrowser-test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,43 @@ define(function (require, exports, module) {
926926
await endPreviewSession();
927927
}, 30000);
928928

929+
it("should hide play button and mode dropdown when previewing markdown file", async function () {
930+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
931+
"SpecRunnerUtils.openProjectFiles simple1.html");
932+
933+
await waitsForLiveDevelopmentToOpen();
934+
935+
// Play button and mode dropdown should be visible for HTML files
936+
let $previewBtn = testWindow.$("#previewModeLivePreviewButton");
937+
let $modeBtn = testWindow.$("#livePreviewModeBtn");
938+
expect($previewBtn.is(":visible")).toBeTrue();
939+
expect($modeBtn.is(":visible")).toBeTrue();
940+
941+
// Open a markdown file
942+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["readme.md"]),
943+
"readme.md");
944+
await awaits(300);
945+
946+
// Play button and mode dropdown should be hidden for markdown files
947+
await awaitsFor(() => {
948+
return !testWindow.$("#previewModeLivePreviewButton").is(":visible") &&
949+
!testWindow.$("#livePreviewModeBtn").is(":visible");
950+
}, "play button and mode dropdown to be hidden");
951+
952+
// Switch back to HTML file
953+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
954+
"simple1.html");
955+
await awaits(300);
956+
957+
// Play button and mode dropdown should be visible again
958+
await awaitsFor(() => {
959+
return testWindow.$("#previewModeLivePreviewButton").is(":visible") &&
960+
testWindow.$("#livePreviewModeBtn").is(":visible");
961+
}, "play button and mode dropdown to be visible again");
962+
963+
await endPreviewSession();
964+
}, 30000);
965+
929966
it("should not live preview binary image files", async function () {
930967
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
931968
"SpecRunnerUtils.openProjectFiles simple1.html");

0 commit comments

Comments
 (0)