Skip to content

Commit

Permalink
fixing linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
teepeemm committed Oct 8, 2021
1 parent 4de66e4 commit 9e92dcd
Show file tree
Hide file tree
Showing 24 changed files with 407 additions and 386 deletions.
12 changes: 6 additions & 6 deletions spec/LoadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ function itHasLoadedTheData() {
expect( ds.eventSource.getCount() ).toBe(2);
}

function expectDateToMatch(d,year) {
expect( d.getUTCFullYear() ).toBe(year);
expect( d.getUTCMonth() ).toBe(0);
expect( d.getUTCDate() ).toBe(2);
}

function itHasTheCorrectItemProperties() {
expectDateToMatch( ds.eventSource.getEarliestDate() , 1980 );
expectDateToMatch( ds.eventSource.getLatestDate() , 2000 );
Expand Down Expand Up @@ -210,10 +216,4 @@ describe("loadtests", function() {
});
});

function expectDateToMatch(d,year) {
expect( d.getUTCFullYear() ).toBe(year);
expect( d.getUTCMonth() ).toBe(0);
expect( d.getUTCDate() ).toBe(2);
}

};
22 changes: 11 additions & 11 deletions spec/PlacemarkSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ PlacemarkSpec.specs = function (setUpPage) {

let tm, ds, items, correctMultiplePlacemarkCount;

function setUp() {
setUpPage();
tm = PlacemarkSpec.tm;
ds = tm.datasets.test;
items = ds.getItems();
const eventSource = tm.timeline.getBand(0).getEventSource();
tm.timeline.getBand(0).setCenterVisibleDate(eventSource.getEarliestDate());
tm.showDatasets();
correctMultiplePlacemarkCount = PlacemarkSpec.correctMultiplePlacemarkCount;
}

describe("placemarks", function() {
beforeAll(setUp);
it("has the correct number of items", function() {
Expand Down Expand Up @@ -49,15 +60,4 @@ describe("placemarks", function() {
});
});

function setUp() {
setUpPage();
tm = PlacemarkSpec.tm;
ds = tm.datasets.test;
items = ds.getItems();
const eventSource = tm.timeline.getBand(0).getEventSource();
tm.timeline.getBand(0).setCenterVisibleDate(eventSource.getEarliestDate());
tm.showDatasets();
correctMultiplePlacemarkCount = PlacemarkSpec.correctMultiplePlacemarkCount;
}

};
14 changes: 7 additions & 7 deletions spec/basicInfoWindowSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"use strict";

let tm, success;
let tm;

const timeoutInterval = 100,
maxAttempts = 30,
Expand Down Expand Up @@ -36,9 +36,9 @@ function setUpPage() {
});
}

function openWindow(done) {
tm.datasets.test.getItems()[0].openInfoWindow();
testWindowOpen(done,0);
function windowIsOpen() {
// this is effectively the assertion
return $('div.infotitle, div.infodescription').length === 2;
}

function testWindowOpen(done,attempts) {
Expand All @@ -51,9 +51,9 @@ function testWindowOpen(done,attempts) {
}
}

function windowIsOpen() {
// this is effectively the assertion
return $('div.infotitle, div.infodescription').length === 2;
function openWindow(done) {
tm.datasets.test.getItems()[0].openInfoWindow();
testWindowOpen(done,0);
}

function expectNoWindowsOpen() {
Expand Down
10 changes: 5 additions & 5 deletions spec/customInfoWindowSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ const timeoutInterval = 100,
options: { items: items }
};

function setupTest() {
// this is effectively the assertion
return $('span#custom').length === 1;
}

function infoWindowOpen(done,attempts) {
if ( setupTest() ) {
done();
Expand All @@ -83,11 +88,6 @@ function setUpPage() {
});
}

function setupTest() {
// this is effectively the assertion
return $('span#custom').length === 1;
}

function expectNoOpenWindows() {
if ( tm.map.api === 'microsoft' ) {
expect( $('span#custom').css('visibility') ).toBe("hidden");
Expand Down
22 changes: 11 additions & 11 deletions spec/deletionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@ function setUpPage() {
tm.showDatasets();
}

describe("deletion and clearing", function() {
beforeEach(setUpPage);
describe("deletion", deletion);
describe("clearing", clearing);
afterAll( function() {
tm.clear();
$('.timelinediv').empty().removeClass().addClass('timelinediv');
$('.mapdiv').empty().removeAttr('style');
});
});

function deletion() {
it("has the right number of items", function() {
expect( tm.datasets.testA.getItems().length )
Expand Down Expand Up @@ -149,4 +138,15 @@ function clearing() {
});
}

describe("deletion and clearing", function() {
beforeEach(setUpPage);
describe("deletion", deletion);
describe("clearing", clearing);
afterAll( function() {
tm.clear();
$('.timelinediv').empty().removeClass().addClass('timelinediv');
$('.mapdiv').empty().removeAttr('style');
});
});

}());
38 changes: 19 additions & 19 deletions spec/geoRSSSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,6 @@ function setUpPage() {
tm = TimeMap.init(tmOptions);
}

describe("geoRSS", function() {
beforeAll( function() {
spyOn($,'ajax').and.callFake(dataloader);
setUpPage();
});
describe("datasets are defined", datasetsDefined);
describe("rss loading", rssloading);
describe("atom loading", atomloading);
describe("mixed loading", mixedloading);
describe("mixed KML time", mixedKMLtime);
describe("mixed extra tags", mixedExtraTags);
afterAll( function() {
tm.clear();
tm = undefined;
$('.timelinediv').empty().removeClass().addClass('timelinediv');
$('.mapdiv').empty().removeAttr('style');
});
});

function datasetsDefined() {
it("has defined the datasets", function() {
expect( $.ajax ).toHaveBeenCalledTimes(3);
Expand Down Expand Up @@ -251,4 +232,23 @@ function dataloader(args) {
}
}

describe("geoRSS", function() {
beforeAll( function() {
spyOn($,'ajax').and.callFake(dataloader);
setUpPage();
});
describe("datasets are defined", datasetsDefined);
describe("rss loading", rssloading);
describe("atom loading", atomloading);
describe("mixed loading", mixedloading);
describe("mixed KML time", mixedKMLtime);
describe("mixed extra tags", mixedExtraTags);
afterAll( function() {
tm.clear();
tm = undefined;
$('.timelinediv').empty().removeClass().addClass('timelinediv');
$('.mapdiv').empty().removeAttr('style');
});
});

}());
30 changes: 15 additions & 15 deletions spec/initOptionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,6 @@ function expectMapType(timemap, type) {
expect(mxn.Mapstraction[type]).toBe(timemap.map.getMapType());
}

describe("initOptions", function() {
beforeAll(setUpPage);
describe("default map type", defaultMapType);
describe("center and zoom", centerAndZoom);
describe("timeline bands", timelineBands);
afterAll( function() {
tm.clear();
tm2.clear();
tm3.clear();
tm4.clear();
$('.timelinediv').empty().removeClass().addClass('timelinediv');
$('.mapdiv').empty().removeAttr('style');
});
});

function defaultMapType() {
it("has the correct map type", function() {
switch (tm.map.api) {
Expand Down Expand Up @@ -243,4 +228,19 @@ function timelineBands() {
});
}

describe("initOptions", function() {
beforeAll(setUpPage);
describe("default map type", defaultMapType);
describe("center and zoom", centerAndZoom);
describe("timeline bands", timelineBands);
afterAll( function() {
tm.clear();
tm2.clear();
tm3.clear();
tm4.clear();
$('.timelinediv').empty().removeClass().addClass('timelinediv');
$('.mapdiv').empty().removeAttr('style');
});
});

}());
10 changes: 5 additions & 5 deletions spec/iterationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const datasetA = {
datasets: [ datasetA, datasetB ]
};

let eventSource, tm, items, item;
let eventSource, tm;

function setUp() {
tm = TimeMap.init(tmOptions);
Expand All @@ -70,6 +70,10 @@ function setUp() {
eventSource = tm.timeline.getBand(0).getEventSource();
}

function flagwith(num) {
return function (input) { input.flag = num; };
}

describe("iteration tests", function() {
beforeAll(setUp);
it("has the right number of items", function() {
Expand Down Expand Up @@ -128,8 +132,4 @@ describe("iteration tests", function() {
});
});

function flagwith(num) {
return function (input) { input.flag = num; };
}

}());
42 changes: 21 additions & 21 deletions spec/kmlPlacemarkSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,6 @@

"use strict";

function setUpPage() {
spyOn($,'ajax').and.callFake(dataloader);
PlacemarkSpec.tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element (required)
datasets: [
{
title: "Test Dataset: KML",
id: "test",
type: "kml",
options: { url: "data/placemarks.kml" }
}
]
});
PlacemarkSpec.correctMultiplePlacemarkCount = 3; // no overlay possible in KML
}

describe("kml placemarks", function() {
PlacemarkSpec.specs(setUpPage);
});

function dataloader(args) {
if ( args.url.indexOf("data/placemarks.kml") >= 0 ) {
args.success(`<?xml version="1.0" encoding="UTF-8"?>
Expand Down Expand Up @@ -132,4 +111,25 @@ function dataloader(args) {
}
}

function setUpPage() {
spyOn($,'ajax').and.callFake(dataloader);
PlacemarkSpec.tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element (required)
datasets: [
{
title: "Test Dataset: KML",
id: "test",
type: "kml",
options: { url: "data/placemarks.kml" }
}
]
});
PlacemarkSpec.correctMultiplePlacemarkCount = 3; // no overlay possible in KML
}

describe("kml placemarks", function() {
PlacemarkSpec.specs(setUpPage);
});

}());
Loading

0 comments on commit 9e92dcd

Please sign in to comment.