hellojs-xiaotian
Version:
A clientside Javascript library for standardizing requests to OAuth2 web services (and OAuth1 - with a shim)
52 lines (26 loc) • 1.08 kB
JavaScript
define([], function() {
var domInstance = hello.utils.domInstance;
describe('utils.domInstance', function() {
it('should return true, if type is an HTMLInputElement matches "input"', function() {
var type = 'input';
var value = domInstance(type, document.createElement(type));
expect(value).to.equal(true);
});
it('should return false, if type is an HTMLInputElement matches "form"', function() {
var type = 'input';
var value = domInstance('form', document.createElement(type));
expect(value).to.equal(false);
});
it('should return false, if an object posess as an HTMLInputElement', function() {
var type = 'input';
var value = domInstance('input', {tagName: type});
expect(value).to.equal(false);
});
it('should return false, if second parameter is ommited or null', function() {
expect(domInstance('input')).to.equal(false);
expect(domInstance('input', false)).to.equal(false);
expect(domInstance('input', true)).to.equal(false);
expect(domInstance('input', null)).to.equal(false);
});
});
});