1- var ol = require ( 'openlayers' ) ;
2- require ( '../../../src/openlayers/control/ChangeTileVersion' ) ;
1+ import ol from 'openlayers' ;
2+ import { ChangeTileVersion } from '../../../src/openlayers/control/ChangeTileVersion' ;
3+ import { TileSuperMapRest } from '../../../src/openlayers/mapping/TileSuperMapRest' ;
34
4- describe ( 'openlayers_ChangeTileVersion' , function ( ) {
5+ describe ( 'openlayers_ChangeTileVersion' , ( ) => {
56 var map , baseLayer ;
67 var tileVersions = [
78 {
@@ -40,8 +41,8 @@ describe('openlayers_ChangeTileVersion', function () {
4041 }
4142
4243 } ] ;
43- beforeAll ( function ( ) {
44- testDiv = window . document . createElement ( "div" ) ;
44+ beforeAll ( ( ) => {
45+ var testDiv = window . document . createElement ( "div" ) ;
4546 testDiv . setAttribute ( "id" , "map" ) ;
4647 testDiv . style . styleFloat = "left" ;
4748 testDiv . style . marginLeft = "8px" ;
@@ -52,15 +53,13 @@ describe('openlayers_ChangeTileVersion', function () {
5253 var url = GlobeParameter . China4326URL ;
5354 map = new ol . Map ( {
5455 target : 'map' ,
55- controls : ol . control . defaults ( { attributionOptions : { collapsed : false } } )
56- . extend ( [ new ol . supermap . control . Logo ( ) ] ) ,
5756 view : new ol . View ( {
5857 center : [ 104.79 , 33.03 ] ,
5958 zoom : 4 ,
6059 projection : 'EPSG:4326'
6160 } )
6261 } ) ;
63- baseLayer = new ol . source . TileSuperMapRest ( {
62+ baseLayer = new TileSuperMapRest ( {
6463 origin : [ - 180 , 90 ] ,
6564 url : url ,
6665 wrapX : true
@@ -71,12 +70,12 @@ describe('openlayers_ChangeTileVersion', function () {
7170 } ) ) ;
7271 } ) ;
7372
74- it ( "initialize" , function ( ) {
73+ it ( "initialize" , ( ) => {
7574 var options = {
7675 layer : baseLayer ,
7776 orientation : "horizontal"
7877 } ;
79- var result = new ol . supermap . control . ChangeTileVersion ( options ) ;
78+ var result = new ChangeTileVersion ( options ) ;
8079 expect ( result ) . not . toBeNull ( ) ;
8180 expect ( result . firstLoad ) . toBeTruthy ( ) ;
8281 expect ( result . options . collapsed ) . toBeTruthy ( ) ;
@@ -86,11 +85,11 @@ describe('openlayers_ChangeTileVersion', function () {
8685 expect ( result . options . tooltip ) . toBe ( "top" ) ;
8786 } ) ;
8887
89- it ( "setLayer" , function ( ) {
88+ it ( "setLayer" , ( ) => {
9089 var options = {
9190 orientation : "horizontal"
9291 } ;
93- var changeTileVersion = new ol . supermap . control . ChangeTileVersion ( options ) ;
92+ var changeTileVersion = new ChangeTileVersion ( options ) ;
9493 changeTileVersion . setLayer ( baseLayer ) ;
9594 expect ( changeTileVersion ) . not . toBeNull ( ) ;
9695 expect ( changeTileVersion . firstLoad ) . toBeTruthy ( ) ;
@@ -101,83 +100,83 @@ describe('openlayers_ChangeTileVersion', function () {
101100 expect ( changeTileVersion . options . tooltip ) . toBe ( "top" ) ;
102101 } ) ;
103102
104- it ( "removeLayer" , function ( ) {
103+ it ( "removeLayer" , ( ) => {
105104 var options = {
106105 orientation : "horizontal"
107106 } ;
108- var changeTileVersion = new ol . supermap . control . ChangeTileVersion ( options ) ;
107+ var changeTileVersion = new ChangeTileVersion ( options ) ;
109108 changeTileVersion . removeLayer ( ) ;
110109 expect ( changeTileVersion . options . layer ) . toBeNull ( ) ;
111110 } ) ;
112111
113- it ( "tilesVersion" , function ( ) {
112+ it ( "tilesVersion" , ( ) => {
114113 var options = {
115114 layer : baseLayer ,
116115 orientation : "horizontal"
117116 } ;
118- var changetileversion = new ol . supermap . control . ChangeTileVersion ( options ) ;
117+ var changetileversion = new ChangeTileVersion ( options ) ;
119118 var version = '63477488-e91e-41a1-b029-c1c7b476a64d' ;
120119 changetileversion . update ( tileVersions ) ;
121120 changetileversion . tilesVersion ( version ) ;
122121 expect ( tileVersions [ 0 ] . name ) . toBe ( version ) ;
123122 } ) ;
124123
125- it ( "getValue" , function ( ) {
124+ it ( "getValue" , ( ) => {
126125 var options = {
127126 layer : baseLayer ,
128127 orientation : "horizontal"
129128 } ;
130- var changetileversion = new ol . supermap . control . ChangeTileVersion ( options ) ;
129+ var changetileversion = new ChangeTileVersion ( options ) ;
131130 changetileversion . update ( tileVersions ) ;
132131 var result = changetileversion . getValue ( ) ;
133132 expect ( result ) . not . toBeNull ( ) ;
134133 expect ( result ) . toBe ( '0' ) ;
135134
136135 } ) ;
137136
138- it ( "nextTilesVersion" , function ( ) {
137+ it ( "nextTilesVersion" , ( ) => {
139138 var options = {
140139 layer : baseLayer ,
141140 orientation : "horizontal"
142141 } ;
143- var changetileversion = new ol . supermap . control . ChangeTileVersion ( options ) ;
142+ var changetileversion = new ChangeTileVersion ( options ) ;
144143 changetileversion . update ( tileVersions ) ;
145144 changetileversion . nextTilesVersion ( ) ;
146145 expect ( changetileversion ) . not . toBeNull ( ) ;
147146 expect ( changetileversion . firstLoad ) . toBeFalsy ( ) ;
148147 expect ( changetileversion . getValue ( ) ) . toBe ( '0' ) ;
149148 } ) ;
150149
151- it ( "lastTilesVersion" , function ( ) {
150+ it ( "lastTilesVersion" , ( ) => {
152151 var options = {
153152 layer : baseLayer ,
154153 orientation : "horizontal"
155154 } ;
156- var changetileversion = new ol . supermap . control . ChangeTileVersion ( options ) ;
155+ var changetileversion = new ChangeTileVersion ( options ) ;
157156 changetileversion . update ( tileVersions ) ;
158157 changetileversion . lastTilesVersion ( ) ;
159158 expect ( changetileversion ) . not . toBeNull ( ) ;
160159 expect ( changetileversion . getValue ( ) ) . toBe ( '0' ) ;
161160
162161 } ) ;
163162
164- it ( "setContent" , function ( ) {
163+ it ( "setContent" , ( ) => {
165164 var options = {
166165 layer : baseLayer ,
167166 orientation : "horizontal"
168167 } ;
169- var changetileversion = new ol . supermap . control . ChangeTileVersion ( options ) ;
168+ var changetileversion = new ChangeTileVersion ( options ) ;
170169 var version = tileVersions [ 0 ] ;
171170 changetileversion . setContent ( version ) ;
172171 expect ( changetileversion . tooltip . innerHTML ) . toBe ( "V1" ) ;
173172 } ) ;
174173
175- it ( "getVersion" , function ( ) {
174+ it ( "getVersion" , ( ) => {
176175 var options = {
177176 layer : baseLayer ,
178177 orientation : "horizontal"
179178 } ;
180- var changetileversion = new ol . supermap . control . ChangeTileVersion ( options ) ;
179+ var changetileversion = new ChangeTileVersion ( options ) ;
181180 changetileversion . update ( tileVersions ) ;
182181 var result = changetileversion . getVersion ( ) ;
183182 expect ( result ) . toBe ( '63477488-e91e-41a1-b029-c1c7b476a64d' ) ;
0 commit comments