@@ -13,7 +13,7 @@ import '../../../resources/QueryService.js';
1313var map , url = GlobeParameter . WorldURL , testDiv , clientComputation ;
1414var dataServiceURL = GlobeParameter . wokerURL ;
1515describe ( 'leaflet_clientcomputation_ClientComputationView' , ( ) => {
16- var serviceResult , clientComputationLayer ;
16+ var clientComputationLayer ;
1717 var originalTimeout , resultLayer , setLayer ;
1818 var queryFailedEventArgs = null , serviceSuccessEventArgs = null ;
1919 beforeAll ( ( ) => {
@@ -35,6 +35,7 @@ describe('leaflet_clientcomputation_ClientComputationView', () => {
3535 clientComputation = new ClientComputationView ( wokerURL ) ;
3636 clientComputation . addTo ( map ) ;
3737
38+
3839 var queryUrl = "https://www.supermapol.com/iserver/services/map_ShiLiShuJu/rest/maps/中国历史5级以上地震_1900至2016@自然气候数据" ;
3940 spyOn ( FetchRequest , 'post' ) . and . callFake ( ( url , queryString ) => {
4041 // let param = JSON.parse(queryString.replace(/\'/g, "\""));
@@ -71,6 +72,10 @@ describe('leaflet_clientcomputation_ClientComputationView', () => {
7172 } )
7273 queryBySQLService . events . on ( { 'processCompleted' : QueryBySQLCompleted } ) ;
7374 queryBySQLService . processAsync ( params ) ;
75+ document . getElementById ( 'getValueText' ) . style . height = '1px' ;
76+
77+
78+
7479
7580
7681 setTimeout ( ( ) => {
@@ -103,17 +108,20 @@ describe('leaflet_clientcomputation_ClientComputationView', () => {
103108 beforeEach ( ( ) => {
104109 originalTimeout = jasmine . DEFAULT_TIMEOUT_INTERVAL ;
105110 jasmine . DEFAULT_TIMEOUT_INTERVAL = 50000 ;
106- serviceResult = null ;
107111 } ) ;
108112 afterEach ( ( ) => {
109113 jasmine . DEFAULT_TIMEOUT_INTERVAL = originalTimeout ;
110114 } ) ;
115+ afterAll ( ( ) => {
116+ map = null ;
117+ document . body . removeChild ( testDiv ) ;
118+ } ) ;
111119
112120 it ( 'addLayer,isoline' , ( done ) => {
113121 setTimeout ( ( ) => {
114122 try {
115123 expect ( document . getElementById ( 'dropDownTop' ) . getAttribute ( 'data-value' ) ) . toBe ( "isolines" ) ;
116- clientComputation . on ( 'analysissuccessed ' , ( e ) => {
124+ clientComputation . viewModel . on ( 'layerloaded ' , ( e ) => {
117125 try {
118126 if ( e . name . indexOf ( "等值线" ) > - 1 ) {
119127 expect ( e . layer . _layers ) . not . toBeNull ;
@@ -131,7 +139,8 @@ describe('leaflet_clientcomputation_ClientComputationView', () => {
131139 done ( ) ;
132140 }
133141 } ) ;
134- var analysitBtn = document . getElementsByClassName ( 'analysis-btn' ) [ 0 ] ;
142+
143+ var analysitBtn = document . getElementsByClassName ( 'widget-analysis__analysisbtn--analysis' ) [ 0 ] ;
135144 analysitBtn . click ( ) ;
136145 } catch ( exception ) {
137146 expect ( false ) . toBeTruthy ( ) ;
@@ -147,11 +156,11 @@ describe('leaflet_clientcomputation_ClientComputationView', () => {
147156 setTimeout ( ( ) => {
148157 try {
149158 document . getElementById ( 'dropDownTop' ) . click ( ) ;
150- document . getElementsByClassName ( 'drop-down-item ' ) [ 2 ] . click ( ) ;
151- clientComputation . on ( 'analysissuccessed ' , ( e ) => {
159+ document . getElementsByClassName ( 'widget-dropdownbox__item ' ) [ 2 ] . click ( ) ;
160+ clientComputation . viewModel . on ( 'layerloaded ' , ( e ) => {
152161 try {
153162 if ( e . name . indexOf ( "等值线" ) > - 1 ) {
154- expect ( e . layer . _layers ) . not . toBeNull ;
163+ expect ( e . name . layer . _layers ) . not . toBeNull ;
155164 expect ( e . layer . _layers ) . not . toBeUndefined ;
156165 done ( ) ;
157166 }
@@ -169,15 +178,15 @@ describe('leaflet_clientcomputation_ClientComputationView', () => {
169178 }
170179 } ) ;
171180 expect ( document . getElementById ( 'bufferRadiusInput' ) . getAttribute ( 'placeholder' ) ) . toContain ( "10千米" ) ;
172- var analysitBtn = document . getElementsByClassName ( 'analysis-btn ' ) [ 0 ] ;
181+ var analysitBtn = document . getElementsByClassName ( 'widget-analysis__analysisbtn--analysis ' ) [ 0 ] ;
173182 analysitBtn . click ( ) ;
174183
175184 } catch ( exception ) {
176185 expect ( false ) . toBeTruthy ( ) ;
177186 console . log ( "clientcomputation" + exception . name + ":" + exception . message ) ;
178187 done ( ) ;
179188 }
180- } , 4000 )
189+ } , 1000 )
181190
182191 } ) ;
183192
0 commit comments