@@ -3,135 +3,135 @@ module("Decorators")
33var Utils = require ( "select2/utils" ) ;
44
55test ( "overridden - method" , function ( assert ) {
6- function BaseClass ( ) { } ;
6+ function BaseClass ( ) { } ;
77
8- BaseClass . prototype . hello = function ( ) {
9- return "A" ;
10- }
8+ BaseClass . prototype . hello = function ( ) {
9+ return "A" ;
10+ }
1111
12- function DecoratorClass ( ) { } ;
12+ function DecoratorClass ( ) { } ;
1313
14- DecoratorClass . prototype . hello = function ( ) {
15- return "B" ;
16- }
14+ DecoratorClass . prototype . hello = function ( ) {
15+ return "B" ;
16+ }
1717
18- var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
18+ var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
1919
20- var inst = new DecoratedClass ( ) ;
20+ var inst = new DecoratedClass ( ) ;
2121
22- assert . strictEqual ( inst . hello ( ) , "B" ) ;
22+ assert . strictEqual ( inst . hello ( ) , "B" ) ;
2323} ) ;
2424
2525test ( "overridden - constructor" , function ( assert ) {
26- function BaseClass ( ) {
27- this . inherited = true ;
28- } ;
26+ function BaseClass ( ) {
27+ this . inherited = true ;
28+ } ;
2929
30- BaseClass . prototype . hello = function ( ) {
31- return "A" ;
32- }
30+ BaseClass . prototype . hello = function ( ) {
31+ return "A" ;
32+ }
3333
34- function DecoratorClass ( decorated ) {
35- this . called = true ;
36- } ;
34+ function DecoratorClass ( decorated ) {
35+ this . called = true ;
36+ } ;
3737
38- DecoratorClass . prototype . other = function ( ) {
39- return "B" ;
40- }
38+ DecoratorClass . prototype . other = function ( ) {
39+ return "B" ;
40+ }
4141
42- var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
42+ var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
4343
44- var inst = new DecoratedClass ( ) ;
44+ var inst = new DecoratedClass ( ) ;
4545
46- assert . ok ( inst . called ) ;
47- assert . ok ( ! inst . inherited ) ;
46+ assert . ok ( inst . called ) ;
47+ assert . ok ( ! inst . inherited ) ;
4848} ) ;
4949
5050test ( "not overridden - method" , function ( assert ) {
51- function BaseClass ( ) { } ;
51+ function BaseClass ( ) { } ;
5252
53- BaseClass . prototype . hello = function ( ) {
54- return "A" ;
55- }
53+ BaseClass . prototype . hello = function ( ) {
54+ return "A" ;
55+ }
5656
57- function DecoratorClass ( ) { } ;
57+ function DecoratorClass ( ) { } ;
5858
59- DecoratorClass . prototype . other = function ( ) {
60- return "B" ;
61- }
59+ DecoratorClass . prototype . other = function ( ) {
60+ return "B" ;
61+ }
6262
63- var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
63+ var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
6464
65- var inst = new DecoratedClass ( ) ;
65+ var inst = new DecoratedClass ( ) ;
6666
67- assert . strictEqual ( inst . hello ( ) , "A" ) ;
67+ assert . strictEqual ( inst . hello ( ) , "A" ) ;
6868} ) ;
6969
7070test ( "not overridden - constructor" , function ( assert ) {
71- function BaseClass ( ) {
72- this . called = true ;
73- } ;
71+ function BaseClass ( ) {
72+ this . called = true ;
73+ } ;
7474
75- BaseClass . prototype . hello = function ( ) {
76- return "A" ;
77- }
75+ BaseClass . prototype . hello = function ( ) {
76+ return "A" ;
77+ }
7878
79- function DecoratorClass ( ) { } ;
79+ function DecoratorClass ( ) { } ;
8080
81- DecoratorClass . prototype . other = function ( ) {
82- return "B" ;
83- }
81+ DecoratorClass . prototype . other = function ( ) {
82+ return "B" ;
83+ }
8484
85- var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
85+ var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
8686
87- var inst = new DecoratedClass ( ) ;
87+ var inst = new DecoratedClass ( ) ;
8888
89- assert . ok ( inst . called ) ;
89+ assert . ok ( inst . called ) ;
9090} ) ;
9191
9292test ( "inherited - method" , function ( assert ) {
93- function BaseClass ( ) { } ;
93+ function BaseClass ( ) { } ;
9494
95- BaseClass . prototype . hello = function ( ) {
96- return "A" ;
97- }
95+ BaseClass . prototype . hello = function ( ) {
96+ return "A" ;
97+ }
9898
99- function DecoratorClass ( decorated ) { } ;
99+ function DecoratorClass ( decorated ) { } ;
100100
101- DecoratorClass . prototype . hello = function ( decorated ) {
102- return "B" + decorated . call ( this ) + "C" ;
103- }
101+ DecoratorClass . prototype . hello = function ( decorated ) {
102+ return "B" + decorated . call ( this ) + "C" ;
103+ }
104104
105- var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
105+ var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
106106
107- var inst = new DecoratedClass ( ) ;
107+ var inst = new DecoratedClass ( ) ;
108108
109- assert . strictEqual ( inst . hello ( ) , "BAC" ) ;
109+ assert . strictEqual ( inst . hello ( ) , "BAC" ) ;
110110} ) ;
111111
112112test ( "inherited - constructor" , function ( assert ) {
113- function BaseClass ( ) {
114- this . inherited = true ;
115- } ;
113+ function BaseClass ( ) {
114+ this . inherited = true ;
115+ } ;
116116
117- BaseClass . prototype . hello = function ( ) {
118- return "A" ;
119- }
117+ BaseClass . prototype . hello = function ( ) {
118+ return "A" ;
119+ }
120120
121- function DecoratorClass ( decorated ) {
122- this . called = true ;
121+ function DecoratorClass ( decorated ) {
122+ this . called = true ;
123123
124- decorated . call ( this ) ;
125- } ;
124+ decorated . call ( this ) ;
125+ } ;
126126
127- DecoratorClass . prototype . other = function ( ) {
128- return "B" ;
129- }
127+ DecoratorClass . prototype . other = function ( ) {
128+ return "B" ;
129+ }
130130
131- var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
131+ var DecoratedClass = Utils . Decorate ( BaseClass , DecoratorClass ) ;
132132
133- var inst = new DecoratedClass ( ) ;
133+ var inst = new DecoratedClass ( ) ;
134134
135- assert . ok ( inst . called ) ;
136- assert . ok ( inst . inherited ) ;
135+ assert . ok ( inst . called ) ;
136+ assert . ok ( inst . inherited ) ;
137137} ) ;
0 commit comments