Transformed
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
|
||||
|
||||
goog.require('ol.uri');
|
||||
import _ol_uri_ from '../../../src/ol/uri.js';
|
||||
|
||||
|
||||
describe('ol.uri.appendParams()', function() {
|
||||
|
||||
it('should append empty STYLES with =', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo', {
|
||||
SERVICE: 'WMS',
|
||||
STYLES: ''
|
||||
});
|
||||
@@ -14,56 +12,56 @@ describe('ol.uri.appendParams()', function() {
|
||||
});
|
||||
|
||||
it('should URL encode values but not names', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo', {
|
||||
'k ': 'v '
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?k =v%20');
|
||||
});
|
||||
|
||||
it('should append to simple base URL', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo', {
|
||||
k: 'v'
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?k=v');
|
||||
});
|
||||
|
||||
it('should append to base URL with ?', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo?', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo?', {
|
||||
k: 'v'
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?k=v');
|
||||
});
|
||||
|
||||
it('should append to base URL with single existing param', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo?bar=bam', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo?bar=bam', {
|
||||
k: 'v'
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?bar=bam&k=v');
|
||||
});
|
||||
|
||||
it('should append to base URL with single existing param and extraneous &', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo?bar=bam&', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo?bar=bam&', {
|
||||
k: 'v'
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?bar=bam&k=v');
|
||||
});
|
||||
|
||||
it('should append to base URL with two existing params', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo?bar=bam&baz=bat', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo?bar=bam&baz=bat', {
|
||||
k: 'v'
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?bar=bam&baz=bat&k=v');
|
||||
});
|
||||
|
||||
it('should append to base URL with three existing params last one empty', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo?bar=bam&baz=bat&bop=', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo?bar=bam&baz=bat&bop=', {
|
||||
k: 'v'
|
||||
});
|
||||
expect(url).to.equal('http://example.com/foo?bar=bam&baz=bat&bop=&k=v');
|
||||
});
|
||||
|
||||
it('should not append null or undefined parameters to the url', function() {
|
||||
var url = ol.uri.appendParams('http://example.com/foo', {
|
||||
var url = _ol_uri_.appendParams('http://example.com/foo', {
|
||||
a: '1',
|
||||
b: null,
|
||||
c: undefined
|
||||
|
||||
Reference in New Issue
Block a user