mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-24 14:43:51 +00:00
Access field should allow "yes" placeholders to be overridden (#2213)
This commit is contained in:
@@ -140,7 +140,13 @@ iD.ui.preset.access = function(field) {
|
||||
|
||||
_.forEach(placeholders[tags.highway], function(value, key) {
|
||||
items.selectAll('#preset-input-access-' + key)
|
||||
.attr('placeholder', value);
|
||||
.attr('placeholder', function() {
|
||||
if (value === 'yes') {
|
||||
return tags.access ? tags.access : value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -74,4 +74,21 @@ describe('iD.ui.preset.access', function() {
|
||||
expect(selection.selectAll('#preset-input-access-motor_vehicle').attr('placeholder')).to.equal('yes');
|
||||
});
|
||||
});
|
||||
|
||||
it('overrides a "yes" placeholder with more specific access tag (#2213)', function() {
|
||||
var access = iD.ui.preset.access(field);
|
||||
selection.call(access);
|
||||
|
||||
access.tags({highway: 'service', access: 'emergency'});
|
||||
expect(selection.selectAll('#preset-input-access-motor_vehicle').attr('placeholder')).to.equal('emergency');
|
||||
});
|
||||
|
||||
it('does not override a "no" placeholder with more specific access tag (#2213)', function() {
|
||||
var access = iD.ui.preset.access(field);
|
||||
selection.call(access);
|
||||
|
||||
access.tags({highway: 'cycleway', access: 'destination'});
|
||||
expect(selection.selectAll('#preset-input-access-motor_vehicle').attr('placeholder')).to.equal('no');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user