Fix access field

This commit is contained in:
Tom MacWright
2016-09-06 10:06:28 -04:00
parent 92f2908ffe
commit 2b366b5f78
2 changed files with 13 additions and 10 deletions
+8 -5
View File
@@ -12,9 +12,10 @@ export function access(field) {
var wrap = selection.selectAll('.preset-input-wrap')
.data([0]);
wrap.enter().append('div')
.attr('class', 'cf preset-input-wrap')
.append('ul');
var divEnter = wrap.enter().append('div')
.attr('class', 'cf preset-input-wrap');
divEnter.append('ul')
wrap = wrap.merge(divEnter);
items = wrap.select('ul').selectAll('li')
.data(field.keys);
@@ -41,6 +42,8 @@ export function access(field) {
.data(access.options(d)));
});
items = items.merge(enter);
// Update
wrap.selectAll('.preset-input-access')
@@ -184,8 +187,8 @@ export function access(field) {
return tags.access ? tags.access : field.placeholder();
});
// items.selectAll('#preset-input-access-access')
// .attr('placeholder', 'yes');
items.selectAll('#preset-input-access-access')
.attr('placeholder', 'yes');
_.forEach(placeholders[tags.highway], function(v, k) {
items.selectAll('#preset-input-access-' + k)
+5 -5
View File
@@ -9,11 +9,11 @@ describe('access', function() {
it('creates inputs for a variety of modes of access', function() {
var access = iD.ui.fields.access(field);
selection.call(access);
expect(selection.selectAll('.preset-access-access')[0].length).to.equal(1);
expect(selection.selectAll('.preset-access-foot')[0].length).to.equal(1);
expect(selection.selectAll('.preset-access-motor_vehicle')[0].length).to.equal(1);
expect(selection.selectAll('.preset-access-bicycle')[0].length).to.equal(1);
expect(selection.selectAll('.preset-access-horse')[0].length).to.equal(1);
expect(selection.selectAll('.preset-access-access').size()).to.equal(1);
expect(selection.selectAll('.preset-access-foot').size()).to.equal(1);
expect(selection.selectAll('.preset-access-motor_vehicle').size()).to.equal(1);
expect(selection.selectAll('.preset-access-bicycle').size()).to.equal(1);
expect(selection.selectAll('.preset-access-horse').size()).to.equal(1);
});
it('does not include "yes", "designated", "dismount" options for general access (#934), (#2213)', function() {