mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-27 02:12:24 +02:00
Fix + symbol appearing in changeset comments from external tools (#10766)
This commit is contained in:
@@ -79,4 +79,13 @@ describe('iD.behaviorHash', function () {
|
||||
done();
|
||||
}, 600);
|
||||
});
|
||||
|
||||
it('accepts default changeset comment as hash parameter', function () {
|
||||
window.location.hash = '#comment=foo+bar%20%2B1';
|
||||
var container = d3.select(document.createElement('div'));
|
||||
context = iD.coreContext().assetPath('../dist/').init().container(container);
|
||||
iD.behaviorHash(context);
|
||||
expect(context.defaultChangesetComment()).to.eql('foo bar +1');
|
||||
hash.off();
|
||||
});
|
||||
});
|
||||
|
||||
+11
-7
@@ -80,31 +80,35 @@ describe('iD.util', function() {
|
||||
|
||||
describe('utilStringQs', function() {
|
||||
it('splits a parameter string into k=v pairs', function() {
|
||||
expect(iD.utilStringQs('')).to.eql({});
|
||||
expect(iD.utilStringQs('foo=bar')).to.eql({foo: 'bar'});
|
||||
expect(iD.utilStringQs('foo=bar&one=2')).to.eql({foo: 'bar', one: '2' });
|
||||
expect(iD.utilStringQs('')).to.eql({});
|
||||
expect(iD.utilStringQs('foo=bar baz')).to.eql({foo: 'bar baz'});
|
||||
expect(iD.utilStringQs('foo=bar+baz')).to.eql({foo: 'bar baz'});
|
||||
expect(iD.utilStringQs('foo=bar%20baz')).to.eql({foo: 'bar baz'});
|
||||
});
|
||||
it('trims leading # if present', function() {
|
||||
expect(iD.utilStringQs('#foo=bar')).to.eql({foo: 'bar'});
|
||||
expect(iD.utilStringQs('#foo=bar&one=2')).to.eql({foo: 'bar', one: '2' });
|
||||
expect(iD.utilStringQs('#')).to.eql({});
|
||||
});
|
||||
it('trims leading ? if present', function() {
|
||||
expect(iD.utilStringQs('?foo=bar')).to.eql({foo: 'bar'});
|
||||
expect(iD.utilStringQs('?foo=bar&one=2')).to.eql({foo: 'bar', one: '2' });
|
||||
expect(iD.utilStringQs('?')).to.eql({});
|
||||
});
|
||||
it('trims leading #? if present', function() {
|
||||
expect(iD.utilStringQs('#?foo=bar')).to.eql({foo: 'bar'});
|
||||
expect(iD.utilStringQs('#?foo=bar&one=2')).to.eql({foo: 'bar', one: '2' });
|
||||
});
|
||||
it('supports both + and %20 for escaping spaces', function() {
|
||||
expect(iD.utilStringQs('#?foo=a+b%20c')).to.eql({foo: 'a b c'});
|
||||
expect(iD.utilStringQs('#?')).to.eql({});
|
||||
});
|
||||
});
|
||||
|
||||
it('utilQsString', function() {
|
||||
expect(iD.utilQsString({})).to.eql('');
|
||||
expect(iD.utilQsString({ foo: 'bar' })).to.eql('foo=bar');
|
||||
expect(iD.utilQsString({ foo: 'bar', one: 2 })).to.eql('foo=bar&one=2');
|
||||
expect(iD.utilQsString({})).to.eql('');
|
||||
expect(iD.utilQsString({ foo: 'bar baz' })).to.be.oneOf(['foo=bar%20baz', 'foo=bar+baz']);
|
||||
expect(iD.utilQsString({ foo: 'bar/baz' })).to.eql('foo=bar%2Fbaz');
|
||||
expect(iD.utilQsString({ foo: 'bar/baz' }, true)).to.eql('foo=bar/baz');
|
||||
});
|
||||
|
||||
describe('utilEditDistance', function() {
|
||||
|
||||
Reference in New Issue
Block a user