mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Modify tests
Assert that new event type is used.
This commit is contained in:
parent
567284189f
commit
eed68e1c7b
2 changed files with 11 additions and 0 deletions
|
@ -126,12 +126,16 @@
|
||||||
window.onload = function(){
|
window.onload = function(){
|
||||||
|
|
||||||
var rmListener = function(x){
|
var rmListener = function(x){
|
||||||
|
assert_true(x instanceof MediaQueryListEvent, "Check that event is instance of MediaQueryListEvent.");
|
||||||
|
|
||||||
resizeTest.step(function(){
|
resizeTest.step(function(){
|
||||||
assert_unreached("removeListener was not successful.");
|
assert_unreached("removeListener was not successful.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var dupListener = function(x){
|
var dupListener = function(x){
|
||||||
|
assert_true(x instanceof MediaQueryListEvent, "Check that event is instance of MediaQueryListEvent.");
|
||||||
|
|
||||||
duplicateListenerTest.step(function(){
|
duplicateListenerTest.step(function(){
|
||||||
assert_false(mql1.dupListenerCalled, "Check that this listener has not been called before.");
|
assert_false(mql1.dupListenerCalled, "Check that this listener has not been called before.");
|
||||||
mql1.dupListenerCalled = true;
|
mql1.dupListenerCalled = true;
|
||||||
|
@ -148,6 +152,8 @@
|
||||||
mql1.addListener(dupListener);
|
mql1.addListener(dupListener);
|
||||||
|
|
||||||
mql1.addListener(function(x){
|
mql1.addListener(function(x){
|
||||||
|
assert_true(x instanceof MediaQueryListEvent, "Check that event is instance of MediaQueryListEvent.");
|
||||||
|
|
||||||
resizeTest.step(function(){
|
resizeTest.step(function(){
|
||||||
assert_equals(x, mql1, "Check that the MediaQueryList passed to the handler is the same that addListener was invoked on.");
|
assert_equals(x, mql1, "Check that the MediaQueryList passed to the handler is the same that addListener was invoked on.");
|
||||||
assert_true(x.matches, "(max-height: 50px) should now pass.");
|
assert_true(x.matches, "(max-height: 50px) should now pass.");
|
||||||
|
@ -162,6 +168,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
mql1.addListener(function(x){
|
mql1.addListener(function(x){
|
||||||
|
assert_true(x instanceof MediaQueryListEvent, "Check that event is instance of MediaQueryListEvent.");
|
||||||
|
|
||||||
listenerOrderTest.step(function(){
|
listenerOrderTest.step(function(){
|
||||||
assert_true(mql1.firstListenerCalled, "Check that the listener added last is called last.");
|
assert_true(mql1.firstListenerCalled, "Check that the listener added last is called last.");
|
||||||
});
|
});
|
||||||
|
@ -171,6 +179,8 @@
|
||||||
mql1.removeListener(rmListener);
|
mql1.removeListener(rmListener);
|
||||||
|
|
||||||
mql2.addListener(function(x){
|
mql2.addListener(function(x){
|
||||||
|
assert_true(x instanceof MediaQueryListEvent, "Check that event is instance of MediaQueryListEvent.");
|
||||||
|
|
||||||
duplicateListenerTest.done();
|
duplicateListenerTest.done();
|
||||||
resizeTest.step(function(){
|
resizeTest.step(function(){
|
||||||
assert_equals(x, mql2, "Check that the MediaQueryList passed to the handler is the same that addListener was invoked on.");
|
assert_equals(x, mql2, "Check that the MediaQueryList passed to the handler is the same that addListener was invoked on.");
|
||||||
|
|
|
@ -143,6 +143,7 @@ test_interfaces([
|
||||||
"MediaError",
|
"MediaError",
|
||||||
"MediaList",
|
"MediaList",
|
||||||
"MediaQueryList",
|
"MediaQueryList",
|
||||||
|
"MediaQueryListEvent",
|
||||||
"MessageEvent",
|
"MessageEvent",
|
||||||
"MimeType",
|
"MimeType",
|
||||||
"MimeTypeArray",
|
"MimeTypeArray",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue