-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1966c15
commit 3119519
Showing
4 changed files
with
266 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
* DeviceProximityEvent_tests.js | ||
* Public Domain Software | ||
* To the extent possible under law, Marcos Caceres has waived all copyright and | ||
* related or neighboring rights to DeviceProximityEvent Implementation. | ||
**/ | ||
test(function() { | ||
assert_throws(TypeError(), function() { | ||
new DeviceProximityEvent(); | ||
}, 'First argument is required, so was expecting a TypeError.'); | ||
}, 'Missing type argument'); | ||
|
||
test(function() { | ||
var event = new DeviceProximityEvent(''); | ||
assert_true(event instanceof window.DeviceProximityEvent); | ||
}, 'the event is an instance of DeviceProximityEvent'); | ||
|
||
test(function() { | ||
var event = new DeviceProximityEvent(''); | ||
assert_true(event instanceof window.Event); | ||
}, 'the event inherits from Event'); | ||
|
||
//Type attribute tests | ||
test(function() { | ||
var event = new DeviceProximityEvent(undefined); | ||
assert_equals(event.type, 'undefined'); | ||
}, 'Event type set to undefined'); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(null); | ||
assert_equals(event.type, 'null'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(123); | ||
assert_equals(event.type, '123'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(new Number(123)); | ||
assert_equals(event.type, '123'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent([]); | ||
assert_equals(event.type, ''); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(new Array()); | ||
assert_equals(event.type, ''); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(['t', ['e', ['s', ['t']]]]); | ||
assert_equals(event.type, 't,e,s,t'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(Math); | ||
assert_equals(event.type, '[object Math]'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(true); | ||
assert_equals(event.type, 'true'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(new Boolean(true)); | ||
assert_equals(event.type, 'true'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(false); | ||
assert_equals(event.type, 'false'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(new Boolean(false)); | ||
assert_equals(event.type, 'false'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent('test'); | ||
assert_equals(event.type, 'test'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(new String('test')); | ||
assert_equals(event.type, 'test'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent(function test() {}); | ||
assert_equals(event.type, 'function test() {}'); | ||
}, ''); | ||
|
||
test(function() { | ||
event = new DeviceProximityEvent({ | ||
toString: function() { | ||
return '123'; | ||
} | ||
}); | ||
assert_equals(event.type, '123'); | ||
}, ''); | ||
|
||
test(function() { | ||
assert_throws(TypeError(), function() { | ||
new new DeviceProximityEvent({ | ||
toString: function() { | ||
return function() {} | ||
} | ||
}); | ||
}); | ||
}, ''); |
Oops, something went wrong.