diff --git a/content/events/test/mochitest.ini b/content/events/test/mochitest.ini
index 9ad7c398163..4522162b975 100644
--- a/content/events/test/mochitest.ini
+++ b/content/events/test/mochitest.ini
@@ -45,6 +45,7 @@ support-files =
[test_bug493251.html]
[test_bug502818.html]
[test_bug508479.html]
+[test_bug822898.html]
[test_bug517851.html]
[test_bug534833.html]
[test_bug545268.html]
diff --git a/content/events/test/test_all_synthetic_events.html b/content/events/test/test_all_synthetic_events.html
index 4655a3a3200..f99c3fe6ea7 100644
--- a/content/events/test/test_all_synthetic_events.html
+++ b/content/events/test/test_all_synthetic_events.html
@@ -294,6 +294,10 @@ const kEventConstructors = {
return new PageTransitionEvent(aName, aProps);
},
},
+ PointerEvent: { create: function (aName, aProps) {
+ return new PointerEvent(aName, aProps);
+ },
+ },
PopStateEvent: { create: function (aName, aProps) {
return new PopStateEvent(aName, aProps);
},
diff --git a/content/events/test/test_bug822898.html b/content/events/test/test_bug822898.html
new file mode 100644
index 00000000000..ac133fcd48a
--- /dev/null
+++ b/content/events/test/test_bug822898.html
@@ -0,0 +1,267 @@
+
+
+
+
+ Test for Bug 822898
+
+
+
+
+Mozilla Bug 822898
+
+
+
+
+
+
+
+
+ testTarget
+
+
+
diff --git a/content/events/test/test_eventctors.html b/content/events/test/test_eventctors.html
index 2a8ddbd648e..47e6a300854 100644
--- a/content/events/test/test_eventctors.html
+++ b/content/events/test/test_eventctors.html
@@ -724,6 +724,82 @@ while (testWheelProps.length) {
}
}
+// PointerEvent
+
+SpecialPowers.setBoolPref("dom.w3c_pointer_events.enabled", true); // Enable Pointer Events
+
+try {
+ e = new PointerEvent();
+} catch(exp) {
+ ex = true;
+}
+ok(ex, "PointerEvent: First parameter is required!");
+ex = false;
+
+e = new PointerEvent("hello");
+ok(e.type, "hello", "PointerEvent: Wrong event type!");
+ok(!e.isTrusted, "PointerEvent: Event shouldn't be trusted!");
+ok(!e.bubbles, "PointerEvent: Event shouldn't bubble!");
+ok(!e.cancelable, "PointerEvent: Event shouldn't be cancelable!");
+document.dispatchEvent(e);
+is(receivedEvent, e, "PointerEvent: Wrong event!");
+
+var PointerEventProps =
+[ { screenX: 0 },
+ { screenY: 0 },
+ { clientX: 0 },
+ { clientY: 0 },
+ { ctrlKey: false },
+ { shiftKey: false },
+ { altKey: false },
+ { metaKey: false },
+ { button: 0 },
+ { buttons: 0 },
+ { relatedTarget: null },
+ { pointerId: 0 },
+ { pointerType: "" }
+];
+
+var testPointerProps =
+[
+ { screenX: 1 },
+ { screenY: 2 },
+ { clientX: 3 },
+ { clientY: 4 },
+ { ctrlKey: true },
+ { shiftKey: true },
+ { altKey: true },
+ { metaKey: true },
+ { button: 5 },
+ { buttons: 6 },
+ { relatedTarget: window },
+ { pointerId: 5 },
+ { pointerType: "mouse" }
+];
+
+var defaultPointerEventValues = {};
+for (var i = 0; i < PointerEventProps.length; ++i) {
+ for (prop in PointerEventProps[i]) {
+ ok(prop in e, "PointerEvent: PointerEvent doesn't have property " + prop + "!");
+ defaultPointerEventValues[prop] = PointerEventProps[i][prop];
+ }
+}
+
+while (testPointerProps.length) {
+ var p = testPointerProps.shift();
+ e = new PointerEvent("foo", p);
+ for (var def in defaultPointerEventValues) {
+ if (!(def in p)) {
+ is(e[def], defaultPointerEventValues[def],
+ "PointerEvent: Wrong default value for " + def + "!");
+ } else {
+ is(e[def], p[def], "PointerEvent: Wrong event init value for " + def + "!");
+ }
+ }
+}
+
+SpecialPowers.clearUserPref("dom.w3c_pointer_events.enabled"); // Disable Pointer Events
+