| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** @fileoverview Runs Polymer Appearance Settings elements. */ |
| 6 |
| 7 GEN_INCLUDE(['settings_page_browsertest.js']); |
| 8 |
| 9 /** |
| 10 * Test Polymer Appearance Settings elements. |
| 11 * @constructor |
| 12 * @extends {SettingsPageBrowserTest} |
| 13 */ |
| 14 function AppearanceSettingsBrowserTest() {} |
| 15 |
| 16 AppearanceSettingsBrowserTest.prototype = { |
| 17 __proto__: SettingsPageBrowserTest.prototype, |
| 18 |
| 19 /** @return {string} */ |
| 20 appearancePage: function(selector) { |
| 21 var section = this.getSection(this.getPage('basic'), 'appearance'); |
| 22 assertTrue(!!section); |
| 23 var appearance = section.querySelector('settings-appearance-page'); |
| 24 assertTrue(!!appearance); |
| 25 var result = appearance.$$(selector); |
| 26 assertTrue(!!result); |
| 27 return result; |
| 28 }, |
| 29 }; |
| 30 |
| 31 TEST_F('AppearanceSettingsBrowserTest', 'uiTests', function() { |
| 32 /** |
| 33 * The prefs API that will get a fake implementation. |
| 34 * @type {!SettingsPrivate} |
| 35 */ |
| 36 var settingsPrefs; |
| 37 var self = this; |
| 38 |
| 39 var fontSize = function() { |
| 40 return self.appearancePage( |
| 41 '#defaultFontSize').$$('.iron-selected').textContent.trim(); |
| 42 }; |
| 43 |
| 44 suite('AppearanceHandler', function() { |
| 45 suiteSetup(function() { |
| 46 settingsPrefs = document.querySelector( |
| 47 'cr-settings').$$('settings-prefs'); |
| 48 assertTrue(!!settingsPrefs); |
| 49 return CrSettingsPrefs.initialized; |
| 50 }); |
| 51 |
| 52 test('very small font', function() { |
| 53 settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 9); |
| 54 assertEquals('Very small', fontSize()); |
| 55 }); |
| 56 |
| 57 test('large font', function() { |
| 58 settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 20); |
| 59 assertEquals('Large', fontSize()); |
| 60 }); |
| 61 |
| 62 /** |
| 63 * If the font size is not one of the preset options (e.g. 16, 20, etc.) |
| 64 * then the menu label will be 'Custom' (rather than 'Medium', 'Large', |
| 65 * etc.). |
| 66 */ |
| 67 test('custom font size', function() { |
| 68 settingsPrefs.set( |
| 69 'prefs.webkit.webprefs.default_font_size.value', 19); |
| 70 assertEquals('Custom', fontSize()); |
| 71 }); |
| 72 }); |
| 73 mocha.run(); |
| 74 }); |
| OLD | NEW |