test_SnapshotListItem_01.html (1676B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Test to verify that the delete button only shows up for a snapshot when it has a 5 path. 6 --> 7 <head> 8 <meta charset="utf-8"> 9 <title>Tree component test</title> 10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 11 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> 12 </head> 13 <body> 14 <div id="container"></div> 15 16 <pre id="test"> 17 <script src="head.js" type="application/javascript"></script> 18 <script type="application/javascript"> 19 "use strict"; 20 window.onload = async function() { 21 try { 22 const container = document.getElementById("container"); 23 24 await renderComponent( 25 SnapshotListItem(TEST_SNAPSHOT_LIST_ITEM_PROPS), 26 container 27 ); 28 29 ok(container.querySelector(".delete"), 30 "Should have delete button when there is a path"); 31 32 const pathlessProps = immutableUpdate( 33 TEST_SNAPSHOT_LIST_ITEM_PROPS, 34 {item: immutableUpdate(TEST_SNAPSHOT, {path: null})} 35 ); 36 37 await renderComponent( 38 SnapshotListItem(pathlessProps), 39 container 40 ); 41 42 ok(!container.querySelector(".delete"), 43 "No delete button should be found if there is no path\n"); 44 } catch (e) { 45 ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e)); 46 } finally { 47 SimpleTest.finish(); 48 } 49 }; 50 </script> 51 </pre> 52 </body> 53 </html>