|
1 | 1 | /*
|
2 | 2 | * Copyright (c) 2017 CoNWeT Lab., Universidad Politecnica de Madrid
|
3 |
| - * Copyright (c) 2017-2019 Future Internet Consulting and Development Solutions S.L. |
| 3 | + * Copyright (c) 2017-2021 Future Internet Consulting and Development Solutions S.L. |
4 | 4 | */
|
5 | 5 |
|
6 | 6 | /* global MashupPlatform, MockMP, ol, Widget */
|
|
10 | 10 | "use strict";
|
11 | 11 |
|
12 | 12 | const HTML_FIXTURE = '<div id="map" class="map"></div>\n' +
|
13 |
| - '<div id="button" class="se-btn"><span>Capas</span></div>'; |
| 13 | + '<div id="button" class="se-btn fade"></div><div id="setcenter-button" class="se-btn"></div>'; |
14 | 14 |
|
15 | 15 | const clearDocument = function clearDocument() {
|
16 | 16 | var elements = document.querySelectorAll('body > *:not(.jasmine_html-reporter)');
|
|
147 | 147 | widget.init();
|
148 | 148 |
|
149 | 149 | let layers_button = document.getElementById('button');
|
150 |
| - expect(layers_button.className).toBe('se-btn hidden'); |
| 150 | + expect(layers_button.className).toBe('se-btn fade'); |
151 | 151 | });
|
152 | 152 |
|
153 | 153 | it("widget ref", () => {
|
|
156 | 156 | widget.init();
|
157 | 157 |
|
158 | 158 | let layers_button = document.getElementById('button');
|
159 |
| - expect(layers_button.className).toBe('se-btn'); |
| 159 | + expect(layers_button.className).toBe('se-btn fade in'); |
160 | 160 | });
|
161 | 161 |
|
162 | 162 | it("widget ref (click)", () => {
|
|
219 | 219 |
|
220 | 220 | });
|
221 | 221 |
|
| 222 | + describe("setcenter button", () => { |
| 223 | + |
| 224 | + it("hidden if not started editing", () => { |
| 225 | + MashupPlatform.mashup.context.setContext({editing: false}); |
| 226 | + |
| 227 | + widget.init(); |
| 228 | + |
| 229 | + const setcenter_button = document.getElementById('setcenter-button'); |
| 230 | + expect(setcenter_button.className).toBe('se-btn hidden'); |
| 231 | + }); |
| 232 | + |
| 233 | + it("visible if started editing", () => { |
| 234 | + MashupPlatform.mashup.context.setContext({editing: true}); |
| 235 | + |
| 236 | + widget.init(); |
| 237 | + |
| 238 | + const setcenter_button = document.getElementById('setcenter-button'); |
| 239 | + expect(setcenter_button.className).toBe('se-btn'); |
| 240 | + }); |
| 241 | + |
| 242 | + it("should update dynamically", () => { |
| 243 | + MashupPlatform.mashup.context.setContext({editing: false}); |
| 244 | + widget.init(); |
| 245 | + |
| 246 | + MashupPlatform.mashup.context.registerCallback.calls.argsFor(0)[0]({editing: true}); |
| 247 | + |
| 248 | + const setcenter_button = document.getElementById('setcenter-button'); |
| 249 | + expect(setcenter_button.className).toBe('se-btn'); |
| 250 | + }); |
| 251 | + |
| 252 | + it("should setup current center as the default value for the initialCenter setting", () => { |
| 253 | + MashupPlatform.mashup.context.setContext({editing: true}); |
| 254 | + widget.init(); |
| 255 | + const setcenter_button = document.getElementById('setcenter-button'); |
| 256 | + |
| 257 | + setcenter_button.click(); |
| 258 | + |
| 259 | + expect(MashupPlatform.prefs.set).toHaveBeenCalledWith("initialCenter", jasmine.any(String)); |
| 260 | + }); |
| 261 | + |
| 262 | + }); |
| 263 | + |
222 | 264 | describe("useclustering", () => {
|
223 | 265 |
|
224 | 266 | it("should switch to use a cluster source for the main vector layer", () => {
|
|
0 commit comments