diff --git a/js/id/ui/preset/access.js b/js/id/ui/preset/access.js index 39cb301da..2d4afa45b 100644 --- a/js/id/ui/preset/access.js +++ b/js/id/ui/preset/access.js @@ -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; + } + }); }); }; diff --git a/test/spec/ui/preset/access.js b/test/spec/ui/preset/access.js index 295abffe9..b0b3e04a6 100644 --- a/test/spec/ui/preset/access.js +++ b/test/spec/ui/preset/access.js @@ -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'); + }); + });