style_webkit_scrollbars_test.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2011 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. goog.provide('goog.style.webkitScrollbarsTest');
  15. goog.setTestOnly('goog.style.webkitScrollbarsTest');
  16. goog.require('goog.asserts');
  17. goog.require('goog.style');
  18. /** @suppress {extraRequire} */
  19. goog.require('goog.styleScrollbarTester');
  20. goog.require('goog.testing.ExpectedFailures');
  21. goog.require('goog.testing.jsunit');
  22. goog.require('goog.userAgent');
  23. var expectedFailures;
  24. function setUpPage() {
  25. expectedFailures = new goog.testing.ExpectedFailures();
  26. }
  27. function tearDown() {
  28. expectedFailures.handleTearDown();
  29. // Assert that the test loaded.
  30. goog.asserts.assert(testScrollbarWidth);
  31. }
  32. function testScrollBarWidth_webkitScrollbar() {
  33. expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT);
  34. try {
  35. var width = goog.style.getScrollbarWidth();
  36. assertEquals('Scrollbar width should be 16', 16, width);
  37. } catch (e) {
  38. expectedFailures.handleException(e);
  39. }
  40. }
  41. function testScrollBarWidth_webkitScrollbarWithCustomClass() {
  42. expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT);
  43. try {
  44. var customWidth = goog.style.getScrollbarWidth('otherScrollBar');
  45. assertEquals('Custom width should be 10', 10, customWidth);
  46. } catch (e) {
  47. expectedFailures.handleException(e);
  48. }
  49. }