forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a test for PageError component (mozilla#54)
- Loading branch information
Showing
4 changed files
with
90 additions
and
0 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
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
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
32 changes: 32 additions & 0 deletions
32
devtools/client/webconsole/new-console-output/test/components/test_page-error.html
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE HTML> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf8"> | ||
<title>Test for PageError component</title> | ||
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> | ||
<script type="application/javascript;version=1.8" src="head.js"></script> | ||
<!-- Any copyright is dedicated to the Public Domain. | ||
- http://creativecommons.org/publicdomain/zero/1.0/ --> | ||
</head> | ||
<body> | ||
<p>Test for PageError component</p> | ||
|
||
<script type="text/javascript;version=1.8"> | ||
window.onload = Task.async(function* () { | ||
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages"); | ||
const { PageError } = require("devtools/client/webconsole/new-console-output/components/message-types/page-error"); | ||
|
||
const packet = yield getPacket(null, "pageError"); | ||
const message = prepareMessage(packet); | ||
const rendered = renderComponent(PageError, {message}); | ||
|
||
const queryPath = "div.message.cm-s-mozilla span span.message-flex-body span.message-body.devtools-monospace"; | ||
const messageBody = rendered.querySelectorAll(queryPath); | ||
is(messageBody.length, 1, "PageError outputs expected HTML structure"); | ||
is(messageBody[0].textContent, testCommands.get("pageError").expectedText, "PageError outputs expected text"); | ||
|
||
SimpleTest.finish() | ||
}); | ||
</script> | ||
</body> | ||
</html> |