@@ -5,7 +5,7 @@ describe('DG.TrafficControl', function() {
55
66 centerNsk = [ 55.017493 , 82.819576 ] ,
77 centerSpb = [ 59.937706 , 30.13249 ] ,
8- centerWithoutProject = [ 55.363990665081126 , 77.81307220458986 ] ;
8+ centerWithoutProject = [ 77.81307220458986 , 55.363990665081126 ] ; // севернее Новой земли
99
1010 after ( function ( ) {
1111 controlClass = controlParentActiveClass = controlParentHiddenClass = centerNsk = null ;
@@ -25,61 +25,61 @@ describe('DG.TrafficControl', function() {
2525 center : centerSpb ,
2626 zoom : 15
2727 } ) ;
28-
28+
2929 control = mapContainer . getElementsByClassName ( controlClass ) ;
3030 trafficControl = DG . control . traffic ( ) ;
31-
31+
3232 document . body . appendChild ( mapContainer ) ;
3333 map . addControl ( trafficControl ) ;
3434 } ) ;
35-
35+
3636 after ( function ( ) {
3737 map . remove ( ) ;
3838 document . body . removeChild ( mapContainer ) ;
3939 mapContainer = map = control = trafficControl = controlParent = null ;
4040 } ) ;
41-
41+
4242 describe ( 'module init' , function ( ) {
4343 it ( 'traffic control show' , function ( ) {
4444 expect ( control . length ) . to . be ( 1 ) ;
45-
45+
4646 control = control [ 0 ] ;
4747 controlParent = control . parentElement ;
4848 } ) ;
49-
49+
5050 it ( 'remove hide class from control parent element' , function ( ) {
5151 expect ( controlParent . className ) . not . contain ( controlParentHiddenClass ) ;
5252 } ) ;
5353 } ) ;
54-
54+
5555 describe ( 'turn on control' , function ( ) {
5656 before ( function ( ) {
5757 happen . click ( controlParent ) ;
5858 } ) ;
59-
59+
6060 it ( 'add active class to control parent element' , function ( ) {
6161 expect ( controlParent . className ) . to . contain ( controlParentActiveClass ) ;
6262 } ) ;
63-
63+
6464 it ( 'add traffic layer to map' , function ( ) {
6565 expect ( map . hasLayer ( trafficControl . _trafficLayer ) ) . to . be ( true ) ;
6666 } ) ;
6767 } ) ;
68-
68+
6969 describe ( 'turn off control' , function ( ) {
7070 before ( function ( ) {
7171 happen . click ( controlParent ) ;
7272 } ) ;
73-
73+
7474 it ( 'remove active class from control parent element' , function ( ) {
7575 expect ( controlParent . className ) . not . contain ( controlParentActiveClass ) ;
7676 } ) ;
77-
77+
7878 it ( 'remove traffic layer from map' , function ( ) {
7979 expect ( map . hasLayer ( trafficControl . _trafficLayer ) ) . to . be ( false ) ;
8080 } ) ;
8181 } ) ;
82-
82+
8383 describe ( 'traffic point request' , function ( ) {
8484 var xhr , center , zoom , requests ;
8585
@@ -88,27 +88,27 @@ describe('DG.TrafficControl', function() {
8888 center = map . getCenter ( ) ;
8989 xhr = sinon . useFakeXMLHttpRequest ( ) ;
9090 requests = [ ] ;
91-
91+
9292 xhr . onCreate = function ( xhr ) {
9393 requests . push ( xhr ) ;
9494 } ;
95-
95+
9696 happen . click ( controlParent ) ;
97-
97+
9898 } ) ;
9999
100100 after ( function ( ) {
101101 xhr . restore ( ) ;
102102 map . setView ( center , zoom ) ;
103103 happen . click ( controlParent ) ;
104104 } ) ;
105-
105+
106106 it ( 'traffic points request called' , function ( ) {
107107 var urlRE = new RegExp ( 'http://traffic\\d+.maps.2gis.com/\\w+/meta/score/0/' ) ;
108108 expect ( urlRE . test ( requests [ 0 ] . url ) ) . to . be ( true ) ;
109109 } ) ;
110110 } ) ;
111-
111+
112112 describe ( 'traffic point timer request' , function ( ) {
113113 var xhr , center , zoom , requests , clock ;
114114
@@ -118,13 +118,13 @@ describe('DG.TrafficControl', function() {
118118 xhr = sinon . useFakeXMLHttpRequest ( ) ;
119119 clock = sinon . useFakeTimers ( ) ;
120120 requests = [ ] ;
121-
121+
122122 xhr . onCreate = function ( xhr ) {
123123 requests . push ( xhr ) ;
124124 } ;
125-
125+
126126 happen . click ( controlParent ) ;
127-
127+
128128 } ) ;
129129
130130 after ( function ( ) {
@@ -133,7 +133,7 @@ describe('DG.TrafficControl', function() {
133133 map . setView ( center , zoom ) ;
134134 happen . click ( controlParent ) ;
135135 } ) ;
136-
136+
137137 it ( 'traffic points update request called' , function ( ) {
138138 var urlRE = new RegExp ( 'http://traffic\\d+.maps.2gis.com/\\w+/meta/speed/time/' ) ;
139139 clock . tick ( DG . config . trafficLayerUpdateInterval + 1 ) ;
@@ -155,16 +155,16 @@ describe('DG.TrafficControl', function() {
155155 center : centerSpb ,
156156 zoom : 15
157157 } ) ;
158-
158+
159159 trafficControl = DG . control . traffic ( ) ;
160-
160+
161161 document . body . appendChild ( mapContainer ) ;
162162 map . addControl ( trafficControl ) ;
163163
164164 control = mapContainer . getElementsByClassName ( controlClass ) [ 0 ] ;
165165 controlParent = control . parentElement ;
166166 } ) ;
167-
167+
168168 afterEach ( function ( ) {
169169 map . remove ( ) ;
170170 document . body . removeChild ( mapContainer ) ;
@@ -234,7 +234,7 @@ describe('DG.TrafficControl', function() {
234234 expect ( map . hasLayer ( trafficControl . _trafficLayer ) ) . to . be ( true ) ;
235235 done ( ) ;
236236 } ;
237-
237+
238238 map . setView ( centerWithoutProject , 15 , { animate : false } ) ;
239239 map . on ( 'projectchange' , onProjectChange ) ;
240240 map . setView ( centerSpb , 15 , { animate : false } ) ;
@@ -246,28 +246,28 @@ describe('DG.TrafficControl', function() {
246246 } ) ;
247247 } ) ;
248248
249- describe ( 'traffic test on project change' , function ( ) {
249+ describe ( 'traffic test on project change' , function ( ) {
250250 describe ( 'with traffic off' , function ( ) {
251251 // traffic layer is off after map initialization
252-
252+
253253 it ( 'control parent element haven\'t active class' , function ( ) {
254254 map . setView ( centerNsk , 15 , { animate : false } ) ;
255255 expect ( controlParent . className ) . not . contain ( controlParentActiveClass ) ;
256256 } ) ;
257257 } ) ;
258-
259- describe ( 'with traffic on' , function ( ) {
258+
259+ describe ( 'with traffic on' , function ( ) {
260260 beforeEach ( function ( ) {
261261 // traffic layer is on, click on traffic control
262262 happen . click ( controlParent ) ;
263263 control . innerHTML = - 50 ;
264264 } ) ;
265-
265+
266266 it ( 'control parent element have active class' , function ( ) {
267267 map . setView ( centerNsk , 15 , { animate : false } ) ;
268268 expect ( controlParent . className ) . to . contain ( controlParentActiveClass ) ;
269269 } ) ;
270-
270+
271271 it ( 'update traffic balls in control' , function ( ) {
272272 expect ( control . innerHTML ) . not . be ( - 50 ) ;
273273 } ) ;
0 commit comments