Skip to content

Commit

Permalink
Fix ctrl classes names.
Browse files Browse the repository at this point in the history
  • Loading branch information
francois2metz committed May 14, 2024
1 parent 33d9058 commit d578644
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Discover:

Recommended versions:

* **maplibre-gl** **1.15.2** or newer
* **maplibre-gl** **3.0.0** or newer

**With NPM**

Expand Down
4 changes: 2 additions & 2 deletions dist/maplibre-gl-indoorequal.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LevelControl {
this.indoorequal.on('levelchange', this._cbRefresh);

this.$el = document.createElement('div');
this.$el.classList.add('maplibre-ctrl', 'maplibre-ctrl-group', 'maplibre-ctrl-indoorequal');
this.$el.classList.add('maplibregl-ctrl', 'maplibregl-ctrl-group', 'maplibregl-ctrl-indoorequal');
this._refresh();
}

Expand All @@ -44,7 +44,7 @@ class LevelControl {
strong.textContent = level;
button.appendChild(strong);
if (level == this.indoorequal.level) {
button.classList.add('maplibre-ctrl-active');
button.classList.add('maplibregl-ctrl-active');
}
button.addEventListener('click', () => { this.indoorequal.setLevel(level); });
this.$el.appendChild(button);
Expand Down
4 changes: 2 additions & 2 deletions dist/maplibre-gl-indoorequal.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LevelControl {
this.indoorequal.on('levelchange', this._cbRefresh);

this.$el = document.createElement('div');
this.$el.classList.add('maplibre-ctrl', 'maplibre-ctrl-group', 'maplibre-ctrl-indoorequal');
this.$el.classList.add('maplibregl-ctrl', 'maplibregl-ctrl-group', 'maplibregl-ctrl-indoorequal');
this._refresh();
}

Expand All @@ -42,7 +42,7 @@ class LevelControl {
strong.textContent = level;
button.appendChild(strong);
if (level == this.indoorequal.level) {
button.classList.add('maplibre-ctrl-active');
button.classList.add('maplibregl-ctrl-active');
}
button.addEventListener('click', () => { this.indoorequal.setLevel(level); });
this.$el.appendChild(button);
Expand Down
2 changes: 1 addition & 1 deletion dist/maplibre-gl-indoorequal.umd.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions maplibre-gl-indoorequal.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.maplibre-ctrl-indoorequal button {
.maplibregl-ctrl-indoorequal button {
min-width: 30px;
width: 100%;
}
.maplibre-ctrl-indoorequal .maplibre-ctrl-active {
.maplibregl-ctrl-indoorequal .maplibregl-ctrl-active {
background-color: #b7b7b7;
}
4 changes: 2 additions & 2 deletions src/level_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class LevelControl {
this.indoorequal.on('levelchange', this._cbRefresh);

this.$el = document.createElement('div');
this.$el.classList.add('maplibre-ctrl', 'maplibre-ctrl-group', 'maplibre-ctrl-indoorequal');
this.$el.classList.add('maplibregl-ctrl', 'maplibregl-ctrl-group', 'maplibregl-ctrl-indoorequal');
this._refresh();
}

Expand All @@ -24,7 +24,7 @@ export default class LevelControl {
strong.textContent = level;
button.appendChild(strong);
if (level == this.indoorequal.level) {
button.classList.add('maplibre-ctrl-active');
button.classList.add('maplibregl-ctrl-active');
}
button.addEventListener('click', () => { this.indoorequal.setLevel(level); })
this.$el.appendChild(button);
Expand Down
14 changes: 7 additions & 7 deletions test/level_control.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ describe('LevelControl', () => {
it('create a container', () => {
const control = new LevelControl(indoorEqual);
expect(control.$el).not.toBe(null);
expect(control.$el.classList.contains('maplibre-ctrl')).toBe(true);
expect(control.$el.classList.contains('maplibre-ctrl-group')).toBe(true);
expect(control.$el.classList.contains('maplibre-ctrl-indoorequal')).toBe(true);
expect(control.$el.classList.contains('maplibregl-ctrl')).toBe(true);
expect(control.$el.classList.contains('maplibregl-ctrl-group')).toBe(true);
expect(control.$el.classList.contains('maplibregl-ctrl-indoorequal')).toBe(true);
});

it('render the levels as button', () => {
const levels = ['1', '0'];
indoorEqual.levels = levels;
const control = new LevelControl(indoorEqual);
expect(control.$el.querySelectorAll('button').length).toEqual(2);
expect(control.$el.querySelectorAll('button.maplibre-ctrl-active').length).toEqual(1);
expect(control.$el.querySelector('button.maplibre-ctrl-active').textContent).toEqual('0');
expect(control.$el.querySelectorAll('button.maplibregl-ctrl-active').length).toEqual(1);
expect(control.$el.querySelector('button.maplibregl-ctrl-active').textContent).toEqual('0');
});

it('refresh the control when the levels change', () => {
Expand All @@ -53,8 +53,8 @@ describe('LevelControl', () => {
const control = new LevelControl(indoorEqual);
indoorEqual.level = '1';
events.levelchange('1');
expect(control.$el.querySelectorAll('button.maplibre-ctrl-active').length).toEqual(1);
expect(control.$el.querySelector('button.maplibre-ctrl-active').textContent).toEqual('1');
expect(control.$el.querySelectorAll('button.maplibregl-ctrl-active').length).toEqual(1);
expect(control.$el.querySelector('button.maplibregl-ctrl-active').textContent).toEqual('1');
});

it('remove the container and listener when calling destroy', () => {
Expand Down

0 comments on commit d578644

Please sign in to comment.