Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.ui.NativeButtonRendererTest');
goog.setTestOnly('goog.ui.NativeButtonRendererTest');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.dom.classlist');
goog.require('goog.events');
goog.require('goog.testing.ExpectedFailures');
goog.require('goog.testing.events');
goog.require('goog.testing.jsunit');
goog.require('goog.testing.ui.rendererasserts');
goog.require('goog.ui.Button');
goog.require('goog.ui.Component');
goog.require('goog.ui.NativeButtonRenderer');
goog.require('goog.userAgent');
var sandbox;
var renderer;
var expectedFailures;
var button;
function setUpPage() {
sandbox = goog.dom.getElement('sandbox');
renderer = goog.ui.NativeButtonRenderer.getInstance();
expectedFailures = new goog.testing.ExpectedFailures();
}
function setUp() {
button = new goog.ui.Button('Hello', renderer);
}
function tearDown() {
button.dispose();
goog.dom.removeChildren(sandbox);
expectedFailures.handleTearDown();
}
function testConstructor() {
assertNotNull('Renderer must not be null', renderer);
}
function testGetAriaRole() {
assertUndefined('ARIA role must be undefined', renderer.getAriaRole());
}
function testCreateDom() {
button.setTooltip('Hello, world!');
button.setValue('foo');
var element = renderer.createDom(button);
assertNotNull('Element must not be null', element);
assertEquals(
'Element must be a button', goog.dom.TagName.BUTTON, element.tagName);
assertSameElements(
'Button element must have expected class name', ['goog-button'],
goog.dom.classlist.get(element));
assertFalse('Button element must be enabled', element.disabled);
assertEquals(
'Button element must have expected title', 'Hello, world!',
element.title);
// Expected to fail on IE.
expectedFailures.expectFailureFor(goog.userAgent.IE);
try {
// See http://www.fourmilab.ch/fourmilog/archives/2007-03/000824.html
// for a description of the problem.
assertEquals(
'Button element must have expected value', 'foo', element.value);
assertEquals(
'Button element must have expected contents', 'Hello',
element.innerHTML);
} catch (e) {
expectedFailures.handleException(e);
}
assertFalse(
'Button must not handle its own mouse events',
button.isHandleMouseEvents());
assertFalse(
'Button must not support the custom FOCUSED state',
button.isSupportedState(goog.ui.Component.State.FOCUSED));
}
function testCanDecorate() {
sandbox.innerHTML = '\n' +
'\n' +
'\n' +
'\n' +
'\n' +
'