UNPKG

sku-pg

Version:

Skulpt is a Javascript implementation of Python 2.x. Python that runs in your browser!

80 lines (65 loc) 1.92 kB
<!DOCTYPE html> <html> <!-- Copyright 2011 The Closure Library Authors. All Rights Reserved. Use of this source code is governed by the Apache License, Version 2.0. See the COPYING file for details. --> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Closure Unit Tests - goog.dom.style</title> <script src="../base.js"></script> <script> goog.require('goog.style'); goog.require('goog.styleScrollbarTester'); goog.require('goog.testing.jsunit'); goog.require('goog.testing.ExpectedFailures'); goog.require('goog.userAgent'); </script> <style> /* * Note that we have to apply these styles when the page is loaded or the * scrollbars might not pick them up. */ ::-webkit-scrollbar { width: 16px; height: 16px; } .otherScrollBar::-webkit-scrollbar { width: 10px; height: 10px; } </style> </head> <body> <div id="test-scrollbarwidth" style="background-color: orange; width: 100px; height: 100px; overflow: auto;"> <div style='width: 200px; height: 200px; background-color: red'>Test Scroll bar width with scroll</div> </div> <script> var expectedFailures = new goog.testing.ExpectedFailures(); function tearDown() { expectedFailures.handleTearDown(); // Assert that the test loaded. goog.asserts.assert(testScrollbarWidth); } function testScrollBarWidth_webkitScrollbar() { expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT); try { var width = goog.style.getScrollbarWidth(); assertEquals('Scrollbar width should be 16', 16, width); } catch (e) { expectedFailures.handleException(e); } } function testScrollBarWidth_webkitScrollbarWithCustomClass() { expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT); try { var customWidth = goog.style.getScrollbarWidth('otherScrollBar'); assertEquals('Custom width should be 10', 10, customWidth); } catch (e) { expectedFailures.handleException(e); } } </script> </body> </html>