OLD | NEW |
| (Empty) |
1 Test SVG use element specific event handling using SVGElementInstance: | |
2 | |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
4 | |
5 | |
6 'useElement' is the original use element | |
7 'rectElement' is the original element which gets cloned by the use element | |
8 | |
9 Test #1: Verify that the use element and the contained SVGElementInstance object
s are valid | |
10 | |
11 PASS useElement.toString() is "[object SVGUseElement]" | |
12 PASS useElement.instanceRoot.toString() is "[object SVGElementInstance]" | |
13 PASS useElement.instanceRoot.correspondingElement.toString() is "[object SVGRect
Element]" | |
14 PASS useElement.instanceRoot.correspondingElement == rectElement is true | |
15 PASS useElement.instanceRoot.correspondingUseElement.toString() is "[object SVGU
seElement]" | |
16 PASS useElement.instanceRoot.correspondingUseElement == useElement is true | |
17 PASS typeof useElement.addEventListener is "function" | |
18 PASS typeof useElement.removeEventListener is "function" | |
19 PASS typeof useElement.dispatchEvent is "function" | |
20 | |
21 Test #2: Verify that events dispatched to the SVGElementInstance objects have co
rrect target property values | |
22 | |
23 PASS currentEvent.toString() is "[object MouseEvent]" | |
24 PASS currentEvent.type.toString() is "mouseover" | |
25 PASS currentEvent.target.toString() is "[object SVGElementInstance]" | |
26 PASS currentEvent.currentTarget.toString() is "[object SVGElementInstance]" | |
27 PASS currentEvent.target.correspondingElement == rectElement is true | |
28 PASS currentEvent.target.correspondingUseElement == useElement is true | |
29 PASS currentEvent.currentTarget.correspondingElement == rectElement is true | |
30 PASS currentEvent.currentTarget.correspondingUseElement == useElement is true | |
31 PASS currentEvent.target == currentEvent.currentTarget is true | |
32 PASS currentEvent.target.correspondingElement == currentEvent.currentTarget.corr
espondingElement is true | |
33 PASS currentEvent.target.correspondingUseElement == currentEvent.currentTarget.c
orrespondingUseElement is true | |
34 | |
35 Test #3: Verify that events dispatched by the user end up on the SVGElementInsta
nce objects | |
36 | |
37 PASS currentEvent.toString() is "[object MouseEvent]" | |
38 PASS currentEvent.type.toString() is "mouseover" | |
39 PASS currentEvent.target.toString() is "[object SVGElementInstance]" | |
40 PASS currentEvent.currentTarget.toString() is "[object SVGElementInstance]" | |
41 PASS currentEvent.target.correspondingElement == rectElement is true | |
42 PASS currentEvent.target.correspondingUseElement == useElement is true | |
43 PASS currentEvent.currentTarget.correspondingElement == rectElement is true | |
44 PASS currentEvent.currentTarget.correspondingUseElement == useElement is true | |
45 PASS currentEvent.target == currentEvent.currentTarget is true | |
46 PASS currentEvent.target.correspondingElement == currentEvent.currentTarget.corr
espondingElement is true | |
47 PASS currentEvent.target.correspondingUseElement == currentEvent.currentTarget.c
orrespondingUseElement is true | |
48 | |
49 Test #4: Verify that a click event got dispatched to the original tree as define
d in the markup, when sent to the 'rectElement' | |
50 | |
51 PASS currentEvent.toString() is "[object MouseEvent]" | |
52 PASS currentEvent.type.toString() is "click" | |
53 PASS currentEvent.target.toString() is "[object SVGRectElement]" | |
54 PASS currentEvent.currentTarget.toString() is "[object SVGRectElement]" | |
55 PASS currentEvent.target == rectElement is true | |
56 PASS currentEvent.currentTarget == rectElement is true | |
57 PASS currentEvent.target == currentEvent.currentTarget is true | |
58 | |
59 Test #5: Verify that a click event got dispatched to the instance tree when sent
to the 'useElement.instanceRoot' with an event listener attached to 'rectElemen
t' | |
60 | |
61 PASS currentEvent.toString() is "[object MouseEvent]" | |
62 PASS currentEvent.type.toString() is "click" | |
63 PASS currentEvent.target.toString() is "[object SVGElementInstance]" | |
64 PASS currentEvent.currentTarget.toString() is "[object SVGElementInstance]" | |
65 PASS currentEvent.target.correspondingElement == rectElement is true | |
66 PASS currentEvent.target.correspondingUseElement == useElement is true | |
67 PASS currentEvent.currentTarget.correspondingElement == rectElement is true | |
68 PASS currentEvent.currentTarget.correspondingUseElement == useElement is true | |
69 PASS currentEvent.target == currentEvent.currentTarget is true | |
70 PASS currentEvent.target.correspondingElement == currentEvent.currentTarget.corr
espondingElement is true | |
71 PASS currentEvent.target.correspondingUseElement == currentEvent.currentTarget.c
orrespondingUseElement is true | |
72 | |
73 Test #6: Verify that the original click event listener got removed and a new one
attached is attached to the use root SVGElementInstance | |
74 | |
75 PASS currentEvent.toString() is "[object MouseEvent]" | |
76 PASS currentEvent.type.toString() is "click" | |
77 PASS currentEvent.target.toString() is "[object SVGElementInstance]" | |
78 PASS currentEvent.currentTarget.toString() is "[object SVGElementInstance]" | |
79 PASS currentEvent.target.correspondingElement == rectElement is true | |
80 PASS currentEvent.target.correspondingUseElement == useElement is true | |
81 PASS currentEvent.currentTarget.correspondingElement == rectElement is true | |
82 PASS currentEvent.currentTarget.correspondingUseElement == useElement is true | |
83 PASS currentEvent.target == currentEvent.currentTarget is true | |
84 PASS currentEvent.target.correspondingElement == currentEvent.currentTarget.corr
espondingElement is true | |
85 PASS currentEvent.target.correspondingUseElement == currentEvent.currentTarget.c
orrespondingUseElement is true | |
86 | |
87 Test #7: Verify that the recreating the original click event listener dynamicall
y worked and the event is still dispatched to the instance tree | |
88 | |
89 PASS currentEvent.toString() is "[object MouseEvent]" | |
90 PASS currentEvent.type.toString() is "click" | |
91 PASS currentEvent.target.toString() is "[object SVGElementInstance]" | |
92 PASS currentEvent.currentTarget.toString() is "[object SVGElementInstance]" | |
93 PASS currentEvent.target.correspondingElement == rectElement is true | |
94 PASS currentEvent.target.correspondingUseElement == useElement is true | |
95 PASS currentEvent.currentTarget.correspondingElement == rectElement is true | |
96 PASS currentEvent.currentTarget.correspondingUseElement == useElement is true | |
97 PASS currentEvent.target == currentEvent.currentTarget is true | |
98 PASS currentEvent.target.correspondingElement == currentEvent.currentTarget.corr
espondingElement is true | |
99 PASS currentEvent.target.correspondingUseElement == currentEvent.currentTarget.c
orrespondingUseElement is true | |
100 | |
101 Test #8: Verify that the simulated click event got dispatched to the right targe
t | |
102 | |
103 PASS currentEvent.toString() is "[object MouseEvent]" | |
104 PASS currentEvent.type.toString() is "click" | |
105 PASS currentEvent.target.toString() is "[object SVGElementInstance]" | |
106 PASS currentEvent.currentTarget.toString() is "[object SVGElementInstance]" | |
107 PASS currentEvent.target.correspondingElement == rectElement is true | |
108 PASS currentEvent.target.correspondingUseElement == useElement is true | |
109 PASS currentEvent.currentTarget.correspondingElement == rectElement is true | |
110 PASS currentEvent.currentTarget.correspondingUseElement == useElement is true | |
111 PASS currentEvent.target == currentEvent.currentTarget is true | |
112 PASS currentEvent.target.correspondingElement == currentEvent.currentTarget.corr
espondingElement is true | |
113 PASS currentEvent.target.correspondingUseElement == currentEvent.currentTarget.c
orrespondingUseElement is true | |
114 PASS successfullyParsed is true | |
115 | |
116 TEST COMPLETE | |
117 | |
OLD | NEW |