This repository was archived by the owner on Sep 21, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed
packages/devtools-reps/src/reps Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ function supportsObject(object, noGrip = false) {
6161 return false ;
6262 }
6363
64- return ( object . preview && getGripType ( object , noGrip ) == "HTMLDocument" ) ;
64+ const type = getGripType ( object , noGrip ) ;
65+ return ( object . preview && ( type === "HTMLDocument" || type === "XULDocument" ) ) ;
6566}
6667
6768// Exports from this module
Original file line number Diff line number Diff line change @@ -34,4 +34,21 @@ stubs.set("Location-less Document", {
3434 }
3535} ) ;
3636
37+ stubs . set ( "XULDocument" , {
38+ "type" : "object" ,
39+ "actor" : "server1.conn0.obj434" ,
40+ "class" : "XULDocument" ,
41+ "extensible" : true ,
42+ "frozen" : false ,
43+ "sealed" : false ,
44+ "ownPropertyLength" : 1 ,
45+ "preview" : {
46+ "kind" : "DOMNode" ,
47+ "nodeType" : 9 ,
48+ "nodeName" : "#document" ,
49+ "isConnected" : true ,
50+ "location" : "chrome://browser/content/browser.xul"
51+ }
52+ } ) ;
53+
3754module . exports = stubs ;
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ const {
1414
1515const { Document } = REPS ;
1616const stubs = require ( "../stubs/document" ) ;
17- const stub = stubs . get ( "Document" ) ;
1817
1918describe ( "Document" , ( ) => {
19+ const stub = stubs . get ( "Document" ) ;
2020 it ( "correctly selects Document Rep" , ( ) => {
2121 expect ( getRep ( stub ) ) . toBe ( Document . rep ) ;
2222 } ) ;
@@ -39,3 +39,20 @@ describe("Document", () => {
3939 expect ( renderedComponent . text ( ) ) . toEqual ( "HTMLDocument" ) ;
4040 } ) ;
4141} ) ;
42+
43+ describe ( "XULDocument" , ( ) => {
44+ const stub = stubs . get ( "XULDocument" ) ;
45+ it ( "correctly selects Document Rep" , ( ) => {
46+ expect ( getRep ( stub ) ) . toBe ( Document . rep ) ;
47+ } ) ;
48+
49+ it ( "renders with expected text content" , ( ) => {
50+ const renderedComponent = shallow ( Document . rep ( {
51+ object : stub
52+ } ) ) ;
53+
54+ expect ( renderedComponent . text ( ) )
55+ . toEqual ( "XULDocument chrome://browser/content/browser.xul" ) ;
56+ expectActorAttribute ( renderedComponent , stub . actor ) ;
57+ } ) ;
58+ } ) ;
You can’t perform that action at this time.
0 commit comments