mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-13 14:46:01 +00:00
Fix raw tag editor tests
This commit is contained in:
@@ -12,9 +12,10 @@ export function Disclosure() {
|
||||
var $link = selection.selectAll('.hide-toggle')
|
||||
.data([0]);
|
||||
|
||||
$link.enter().append('a')
|
||||
$link = $link.enter().append('a')
|
||||
.attr('href', '#')
|
||||
.attr('class', 'hide-toggle');
|
||||
.attr('class', 'hide-toggle')
|
||||
.merge($link);
|
||||
|
||||
$link.text(title)
|
||||
.on('click', toggle)
|
||||
@@ -23,7 +24,7 @@ export function Disclosure() {
|
||||
var $body = selection.selectAll('div')
|
||||
.data([0]);
|
||||
|
||||
$body.enter().append('div');
|
||||
$body = $body.enter().append('div').merge($body);
|
||||
|
||||
$body.classed('hide', !expanded)
|
||||
.call(content);
|
||||
|
||||
@@ -54,23 +54,23 @@ describe('iD.ui.RawTagEditor', function() {
|
||||
});
|
||||
|
||||
it('adds tags when pressing the TAB key on last input.value', function (done) {
|
||||
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
|
||||
var input = d3.select('.tag-list li:last-child input.value')[0][0];
|
||||
expect(element.selectAll('.tag-list li').nodes().length).to.eql(1);
|
||||
var input = d3.select('.tag-list li:last-child input.value').nodes()[0];
|
||||
happen.keydown(d3.select(input).node(), {keyCode: 9});
|
||||
setTimeout(function() {
|
||||
expect(element.selectAll('.tag-list li')[0].length).to.eql(2);
|
||||
expect(element.select('.tag-list').selectAll('input')[0][2].value).to.be.empty;
|
||||
expect(element.select('.tag-list').selectAll('input')[0][3].value).to.be.empty;
|
||||
expect(element.selectAll('.tag-list li').nodes().length).to.eql(2);
|
||||
expect(element.select('.tag-list').selectAll('input').nodes()[2].value).to.be.empty;
|
||||
expect(element.select('.tag-list').selectAll('input').nodes()[3].value).to.be.empty;
|
||||
done();
|
||||
}, 20);
|
||||
});
|
||||
|
||||
it('does not add a tag when pressing TAB while shift is pressed', function (done) {
|
||||
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
|
||||
var input = d3.select('.tag-list li:last-child input.value')[0][0];
|
||||
expect(element.selectAll('.tag-list li').nodes().length).to.eql(1);
|
||||
var input = d3.select('.tag-list li:last-child input.value').nodes()[0];
|
||||
happen.keydown(d3.select(input).node(), {keyCode: 9, shiftKey: true});
|
||||
setTimeout(function() {
|
||||
expect(element.selectAll('.tag-list li')[0].length).to.eql(1);
|
||||
expect(element.selectAll('.tag-list li').nodes().length).to.eql(1);
|
||||
done();
|
||||
}, 20);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user