mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1264679 - [rep tests] Add tests for date-time rep. r=mayhemer
DONTBUILD --HG-- extra : source : c4096b7ccbe6e8296e3274841c978efbc5396c64 extra : amend_source : a3102589a7f432b078a91ada01e140446d241a23
This commit is contained in:
parent
26e2fdf1c9
commit
f2c3e30e25
@ -28,7 +28,7 @@ define(function (require, exports, module) {
|
||||
},
|
||||
|
||||
getTitle: function (grip) {
|
||||
return new Date(grip.preview.timestamp).toString();
|
||||
return new Date(grip.preview.timestamp).toISOString();
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
@ -6,6 +6,7 @@ support-files =
|
||||
[test_notification_box_01.html]
|
||||
[test_notification_box_02.html]
|
||||
[test_notification_box_03.html]
|
||||
[test_reps_date-time.html]
|
||||
[test_reps_object-with-url.html]
|
||||
[test_reps_undefined.html]
|
||||
[test_reps_window.html]
|
||||
|
@ -0,0 +1,51 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Test DateTime rep
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Rep test - DateTime</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script src="head.js" type="application/javascript;version=1.8"></script>
|
||||
<script type="application/javascript;version=1.8">
|
||||
window.onload = Task.async(function* () {
|
||||
try {
|
||||
let { Rep } = browserRequire("devtools/client/shared/components/reps/rep");
|
||||
let { DateTime } = browserRequire("devtools/client/shared/components/reps/date-time");
|
||||
|
||||
let gripStub = {
|
||||
"type": "object",
|
||||
"class": "Date",
|
||||
"actor": "server1.conn0.child1/obj32",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"timestamp": 1459372644859
|
||||
}
|
||||
};
|
||||
|
||||
// Test that correct rep is chosen
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: gripStub });
|
||||
is(renderedRep.type, DateTime.rep, `Rep correctly selects ${DateTime.rep.displayName}`);
|
||||
|
||||
// Test rendering
|
||||
const renderedComponent = renderComponent(DateTime.rep, { object: gripStub });
|
||||
is(renderedComponent.textContent, "2016-03-30T21:17:24.859Z", "DateTime rep has expected text content");
|
||||
} catch(e) {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
||||
} finally {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user