Skip to content

Commit

Permalink
update popup tests to use Popup#getElement
Browse files Browse the repository at this point in the history
  • Loading branch information
Molly Lloyd committed Sep 5, 2017
1 parent 549466e commit f4eb12f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/unit/ui/popup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,25 @@ test('Popup content can be set via setText', (t) => {
test('Popup content can be set via setHTML', (t) => {
const map = createMap();

new Popup({closeButton: false})
const popup = new Popup({closeButton: false})
.setLngLat([0, 0])
.addTo(map)
.setHTML("<span>Test</span>");

t.equal(map.getContainer().querySelector('.mapboxgl-popup-content').innerHTML, "<span>Test</span>");
t.equal(popup.getElement().innerHTML, "<span>Test</span>");
t.end();
});

test('Popup content can be set via setDOMContent', (t) => {
const map = createMap();
const content = window.document.createElement('span');

new Popup({closeButton: false})
const popup = new Popup({closeButton: false})
.setLngLat([0, 0])
.addTo(map)
.setDOMContent(content);

t.equal(map.getContainer().querySelector('.mapboxgl-popup-content').firstChild, content);
t.equal(popup.getElement().firstChild, content);
t.end();
});

Expand Down Expand Up @@ -410,13 +410,13 @@ test('Popup can be removed and added again (#1477)', (t) => {
test('Popup#addTo is idempotent (#1811)', (t) => {
const map = createMap();

new Popup({closeButton: false})
const popup = new Popup({closeButton: false})
.setText("Test")
.setLngLat([0, 0])
.addTo(map)
.addTo(map);

t.equal(map.getContainer().querySelector('.mapboxgl-popup-content').textContent, "Test");
t.equal(popup.getElement().textContent, "Test");
t.end();
});

Expand Down

0 comments on commit f4eb12f

Please sign in to comment.