1 <!DOCTYPE html> 2 <!-- 3 Copyright (c) 2010 The Chromium Authors. All rights reserved. 4 Use of this source code is governed by a BSD-style license that can be 5 found in the LICENSE file. 6 --> 7 <html> 8 <head> 9 <title></title> 10 <link rel="stylesheet" href="overlay.css"> 11 <script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script> 12 <script src="../shared/js/cr.js"></script> 13 <script src="../shared/js/cr/ui.js"></script> 14 <script src="overlay.js"></script> 15 <script> 16 17 goog.require('goog.testing.jsunit'); 18 19 </script> 20 21 </head> 22 <body> 23 <div id="sandbox"></div> 24 <script> 25 26 var sandbox = document.getElementById('sandbox'); 27 var overlay; 28 29 function testShowHideUnparented() { 30 overlay = new gpu.Overlay(); 31 overlay.innerHTML = 32 '<h3>Hello</h3>B1:<button>foo</button></p>B2:<button>blah</button>'; 33 overlay.visible = true; 34 assertNotEquals(overlay.parentNode, null); 35 36 overlay.visible = false; 37 assertEquals(overlay.parentNode, null); 38 } 39 40 function testShowHideParented() { 41 overlay = new gpu.Overlay(); 42 overlay.innerHTML = 43 '<h3>Hello</h3>B1:<button>foo</button></p>B2:<button>blah</button>'; 44 document.body.appendChild(overlay); 45 overlay.visible = true; 46 assertNotEquals(overlay.parentNode, null); 47 48 overlay.visible = false; 49 assertEquals(overlay.parentNode, document.body); 50 } 51 52 </script> 53 54 </body> 55 </html> 56 57