Skip to content

Commit

Permalink
Fix indentation on test file
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromml committed Jun 20, 2024
1 parent b65ac4b commit 244ae94
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
2 changes: 1 addition & 1 deletion modules/ui/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function uiField(context, presetField, entityIDs, options) {

// Update
container = container
.merge(enter);
.merge(enter);

container.select('.field-label > .remove-icon') // propagate bound data
.on('click', remove);
Expand Down
67 changes: 33 additions & 34 deletions test/spec/ui/fields/source_subfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,45 @@ describe('iD.uiSourceSubfield', function() {
});

it('creates field:source tag after setting the value', function(done) {
var uiField = iD.uiField(context, field, ['n12345'], {show: true, wrap: true});
window.setTimeout(function() { // async, so data will be available
selection.call(uiField.render);
happen.click(selection.selectAll('.source-icon').node());
var uiField = iD.uiField(context, field, ['n12345'], {show: true, wrap: true});
window.setTimeout(function() { // async, so data will be available
selection.call(uiField.render);
happen.click(selection.selectAll('.source-icon').node());

iD.utilGetSetValue(selection.selectAll('.field-source-value'), 'Book 1');
iD.utilGetSetValue(selection.selectAll('.field-source-value'), 'Book 1');

uiField.on('change', function(tags) {
uiField.on('change', function(tags) {
expect(tags).to.eql({'name:source': 'Book 1'});
});
happen.once(selection.selectAll('.field-source-value').node(), {type: 'change'});
done();

}, 20);
});
});
happen.once(selection.selectAll('.field-source-value').node(), {type: 'change'});
done();
}, 20);
});


it('removes the tag when the value is emptied', function(done) {
var uiField = iD.uiField(context, field, ['n12345'], {show: true, wrap: true});
window.setTimeout(function() { // async, so data will be available
selection.call(uiField.render);
happen.click(selection.selectAll('.source-icon').node());
iD.utilGetSetValue(selection.selectAll('.field-source-value'), 'abc');
it('removes the tag when the value is emptied', function(done) {
var uiField = iD.uiField(context, field, ['n12345'], {show: true, wrap: true});
window.setTimeout(function() { // async, so data will be available
selection.call(uiField.render);
happen.click(selection.selectAll('.source-icon').node());
iD.utilGetSetValue(selection.selectAll('.field-source-value'), 'abc');

uiField.on('change', function(tags) {
expect(tags).to.eql({'name:source': undefined});
});
uiField.on('change', function(tags) {
expect(tags).to.eql({'name:source': undefined});
});

iD.utilGetSetValue(selection.selectAll('.field-source-value'), '');
happen.once(selection.selectAll('.field-source-value').node(), {type: 'change'});
done();
}, 20);
});
iD.utilGetSetValue(selection.selectAll('.field-source-value'), '');
happen.once(selection.selectAll('.field-source-value').node(), {type: 'change'});
done();
}, 20);
});

it('there is no @ button on main source field', function(done) {
var uiField = iD.uiField(context, {...field, source: false}, ['n12345'], {show: true, wrap: true});
window.setTimeout(function() { // async, so data will be available
selection.call(uiField.render);
expect(selection.selectAll('.source-icon').nodes().length).to.equal(0);
done();
}, 20);
});
it('there is no @ button on main source field', function(done) {
var uiField = iD.uiField(context, {...field, source: false}, ['n12345'], {show: true, wrap: true});
window.setTimeout(function() { // async, so data will be available
selection.call(uiField.render);
expect(selection.selectAll('.source-icon').nodes().length).to.equal(0);
done();
}, 20);
});
});

0 comments on commit 244ae94

Please sign in to comment.