зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1088006 - Hook up Loop's ui-showcase to unit tests so that we don't keep on breaking it, and so that it can possibly catch use of es6 errors. r=dmose
This commit is contained in:
Родитель
70dadcd9a7
Коммит
6d635a2c1e
|
@ -20,3 +20,4 @@ qemu = false
|
|||
[test/shared/test_shared_all.py]
|
||||
[test/desktop-local/test_desktop_all.py]
|
||||
[test/standalone/test_standalone_all.py]
|
||||
[test/ui-showcase/test_ui-showcase.py]
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# need to get this dir in the path so that we make the import work
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'shared'))
|
||||
|
||||
from frontend_tester import BaseTestFrontendUnits
|
||||
|
||||
|
||||
class TestDesktopUnits(BaseTestFrontendUnits):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDesktopUnits, self).setUp()
|
||||
self.set_server_prefix("../../ui/")
|
||||
|
||||
def test_units(self):
|
||||
self.check_page("index.html")
|
|
@ -15,7 +15,15 @@
|
|||
<link rel="stylesheet" type="text/css" href="ui-showcase.css">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var uncaughtError;
|
||||
window.addEventListener("error", function(error) {
|
||||
uncaughtError = error;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="main"></div>
|
||||
<div id="results"></div>
|
||||
<script src="fake-mozLoop.js"></script>
|
||||
<script src="fake-l10n.js"></script>
|
||||
<script>
|
||||
|
|
|
@ -737,15 +737,29 @@
|
|||
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
try {
|
||||
React.render(React.createElement(App, null), document.body);
|
||||
React.renderComponent(React.createElement(App, null), document.getElementById("main"));
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
uncaughtError = err;
|
||||
}
|
||||
|
||||
_renderComponentsInIframes();
|
||||
|
||||
// Put the title back, in case views changed it.
|
||||
document.title = "Loop UI Components Showcase";
|
||||
|
||||
// This simulates the mocha layout for errors which means we can run
|
||||
// this alongside our other unit tests but use the same harness.
|
||||
if (uncaughtError) {
|
||||
$("#results").append("<div class='failures'><em>1</em></div>");
|
||||
$("#results").append("<li class='test fail'>" +
|
||||
"<h2>Errors rendering UI-Showcase</h2>" +
|
||||
"<pre class='error'>" + uncaughtError + "\n" + uncaughtError.stack + "</pre>" +
|
||||
"</li>");
|
||||
} else {
|
||||
$("#results").append("<div class='failures'><em>0</em></div>");
|
||||
}
|
||||
$("#results").append("<p id='complete'>Complete.</p>");
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -737,15 +737,29 @@
|
|||
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
try {
|
||||
React.render(<App />, document.body);
|
||||
React.renderComponent(<App />, document.getElementById("main"));
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
uncaughtError = err;
|
||||
}
|
||||
|
||||
_renderComponentsInIframes();
|
||||
|
||||
// Put the title back, in case views changed it.
|
||||
document.title = "Loop UI Components Showcase";
|
||||
|
||||
// This simulates the mocha layout for errors which means we can run
|
||||
// this alongside our other unit tests but use the same harness.
|
||||
if (uncaughtError) {
|
||||
$("#results").append("<div class='failures'><em>1</em></div>");
|
||||
$("#results").append("<li class='test fail'>" +
|
||||
"<h2>Errors rendering UI-Showcase</h2>" +
|
||||
"<pre class='error'>" + uncaughtError + "\n" + uncaughtError.stack + "</pre>" +
|
||||
"</li>");
|
||||
} else {
|
||||
$("#results").append("<div class='failures'><em>0</em></div>");
|
||||
}
|
||||
$("#results").append("<p id='complete'>Complete.</p>");
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
Загрузка…
Ссылка в новой задаче