fix calculation of access field placeholder on multiselections

This commit is contained in:
Martin Raifer
2022-10-10 13:28:00 +02:00
parent 70e92f24e3
commit 771ad4dbd9
4 changed files with 68 additions and 35 deletions

View File

@@ -112,4 +112,28 @@ describe('iD.uiFieldAccess', function() {
expect(selection.selectAll('.preset-input-access-motor_vehicle').attr('placeholder')).to.equal('destination');
});
it('sets bicycle and motor_vehicle placeholder to the value of the "vehicle" tag (id-tagging-schema#378)', function() {
var access = iD.uiFieldAccess(field, context);
selection.call(access);
access.tags({highway: 'residential', vehicle: 'destination'});
expect(selection.selectAll('.preset-input-access-motor_vehicle').attr('placeholder')).to.equal('destination');
expect(selection.selectAll('.preset-input-access-bicycle').attr('placeholder')).to.equal('destination');
});
it('sets correct placeholder on a multi selection', function() {
var access = iD.uiFieldAccess(field, context);
selection.call(access);
var tags = {highway: 'primary', foot: ['yes', 'no'], bicycle: ['no', undefined], vehicle: ['no', undefined]};
tags[Symbol.for('allTags')] = [
{highway: 'primary', foot: 'yes', bicycle: 'no'},
{highway: 'primary', foot: 'no', vehicle: 'no'}
];
access.tags(tags);
expect(selection.selectAll('.preset-input-access-foot').attr('placeholder')).to.equal(iD.localizer.t('inspector.multiple_values'));
expect(selection.selectAll('.preset-input-access-bicycle').attr('placeholder')).to.equal('no');
expect(selection.selectAll('.preset-input-access-motor_vehicle').attr('placeholder')).to.equal(iD.localizer.t('inspector.multiple_values'));
});
});