| 1 |
// Copyright 2013 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 |
|
| 15 |
goog.provide('goog.ui.DimensionPickerRendererTest'); |
| 16 |
goog.setTestOnly('goog.ui.DimensionPickerRendererTest'); |
| 17 |
|
| 18 |
goog.require('goog.a11y.aria.LivePriority'); |
| 19 |
goog.require('goog.array'); |
| 20 |
goog.require('goog.testing.jsunit'); |
| 21 |
goog.require('goog.testing.recordFunction'); |
| 22 |
goog.require('goog.ui.DimensionPicker'); |
| 23 |
goog.require('goog.ui.DimensionPickerRenderer'); |
| 24 |
|
| 25 |
|
| 26 |
var renderer; |
| 27 |
var picker; |
| 28 |
|
| 29 |
function setUp() { |
| 30 |
renderer = new goog.ui.DimensionPickerRenderer(); |
| 31 |
picker = new goog.ui.DimensionPicker(renderer); |
| 32 |
} |
| 33 |
|
| 34 |
function tearDown() { |
| 35 |
picker.dispose(); |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
/** |
| 40 |
* Tests that the right aria label is added when the highlighted |
| 41 |
* size changes. |
| 42 |
*/ |
| 43 |
function testSetHighlightedSizeUpdatesLiveRegion() { |
| 44 |
picker.render(); |
| 45 |
|
| 46 |
var sayFunction = goog.testing.recordFunction(); |
| 47 |
renderer.announcer_.say = sayFunction; |
| 48 |
renderer.setHighlightedSize(picker, 3, 7); |
| 49 |
|
| 50 |
assertEquals(1, sayFunction.getCallCount()); |
| 51 |
|
| 52 |
assertTrue( |
| 53 |
goog.array.equals( |
| 54 |
['3 by 7', goog.a11y.aria.LivePriority.ASSERTIVE], |
| 55 |
sayFunction.getLastCall().getArguments())); |
| 56 |
} |