Tests for setUrl() and setUrls()

This commit is contained in:
Tim Schaub
2016-05-19 09:00:43 -06:00
parent b2b902e22f
commit feb6fe9dce

View File

@@ -3,6 +3,54 @@ goog.provide('ol.test.source.UrlTile');
describe('ol.source.UrlTile', function() {
describe('#setUrl()', function() {
it('sets the URL for the source', function() {
var source = new ol.source.UrlTile({});
var url = 'https://example.com/';
source.setUrl(url);
expect(source.getUrls()).to.eql([url]);
});
it('updates the key for the source', function() {
var source = new ol.source.UrlTile({});
var url = 'https://example.com/';
source.setUrl(url);
expect(source.getKey()).to.eql(url);
});
});
describe('#setUrls()', function() {
it('sets the URL for the source', function() {
var source = new ol.source.UrlTile({});
var urls = [
'https://a.example.com/',
'https://b.example.com/',
'https://c.example.com/'
];
source.setUrls(urls);
expect(source.getUrls()).to.eql(urls);
});
it('updates the key for the source', function() {
var source = new ol.source.UrlTile({});
var urls = [
'https://a.example.com/',
'https://b.example.com/',
'https://c.example.com/'
];
source.setUrls(urls);
expect(source.getKey()).to.eql(urls.join('\n'));
});
});
describe('url option', function() {
it('expands url template', function() {
var tileSource = new ol.source.UrlTile({