author | Lin Clark <lclark@mozilla.com> |
Fri, 24 Jun 2016 07:07:42 -0400 | |
changeset 305404 | 102f746a6474f266c6ac3762c03d2f0d4ff32479 |
parent 305403 | 57fe98edfc3de29eb4a1336e5fd23073839d9667 |
child 305405 | 7324716faa31f0e982a4c83144ea19ea84085197 |
push id | 30463 |
push user | cbook@mozilla.com |
push date | Tue, 19 Jul 2016 14:02:45 +0000 |
treeherder | mozilla-central@37cc0da01187 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | me |
bugs | 1264681 |
milestone | 50.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/devtools/client/shared/components/test/mochitest/chrome.ini +++ b/devtools/client/shared/components/test/mochitest/chrome.ini @@ -5,16 +5,17 @@ support-files = [test_frame_01.html] [test_HSplitBox_01.html] [test_notification_box_01.html] [test_notification_box_02.html] [test_notification_box_03.html] [test_reps_array.html] [test_reps_attribute.html] [test_reps_date-time.html] +[test_reps_document.html] [test_reps_function.html] [test_reps_grip.html] [test_reps_grip-array.html] [test_reps_null.html] [test_reps_number.html] [test_reps_object.html] [test_reps_object-with-text.html] [test_reps_object-with-url.html]
new file mode 100644 --- /dev/null +++ b/devtools/client/shared/components/test/mochitest/test_reps_document.html @@ -0,0 +1,54 @@ + +<!DOCTYPE HTML> +<html> +<!-- +Test Document rep +--> +<head> + <meta charset="utf-8"> + <title>Rep test - Document</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* () { + let { Rep } = browserRequire("devtools/client/shared/components/reps/rep"); + let { Document } = browserRequire("devtools/client/shared/components/reps/document"); + + try { + let gripStub = { + "type": "object", + "class": "HTMLDocument", + "actor": "server1.conn17.obj115", + "extensible": true, + "frozen": false, + "sealed": false, + "ownPropertyLength": 1, + "preview": { + "kind": "DOMNode", + "nodeType": 9, + "nodeName": "#document", + "location": "https://www.mozilla.org/en-US/firefox/new/" + } + }; + + // Test that correct rep is chosen + const renderedRep = shallowRenderComponent(Rep, { object: gripStub }); + is(renderedRep.type, Document.rep, `Rep correctly selects ${Document.rep.displayName}`); + + // Test rendering + const renderedComponent = renderComponent(Document.rep, { object: gripStub }); + is(renderedComponent.textContent, "/en-US/firefox/new/", "Document rep has expected text content"); + } catch(e) { + ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e)); + } finally { + SimpleTest.finish(); + } +}); +</script> +</pre> +</body> +</html>