Commit 477d4467 authored by Kushan Joshi's avatar Kushan Joshi

final touch up

parent 780960c7
......@@ -362,7 +362,7 @@ window.iD = function () {
context.undo = withDebouncedSave(history.undo);
context.redo = withDebouncedSave(history.redo);
ui = iD.ui(context);
ui = iD.ui.init(context);
connection = iD.Connection();
......
This diff is collapsed.
......@@ -10,6 +10,6 @@
"no-invalid-this": 0
},
globals: {
# "iD": false,
"iD": false,
}
}
import { intro } from '../intro';
import { modal } from '../modal';
import { icon } from './helper';
export function startEditing(context, reveal) {
var event = d3.dispatch('done', 'startEditing'),
......@@ -16,7 +16,7 @@ export function startEditing(context, reveal) {
step.enter = function() {
reveal('.map-control.help-control',
t('intro.startediting.help', { button: intro.icon('#icon-help', 'pre-text') }));
t('intro.startediting.help', { button: icon('#icon-help', 'pre-text') }));
timeout(function() {
reveal('#bar button.save', t('intro.startediting.save'));
......
......@@ -123,9 +123,9 @@
<script src='spec/ui/confirm.js'></script>
<script src='spec/ui/cmd.js'></script>
<script src='spec/ui/preset/access.js'></script>
<script src='spec/ui/preset/localized.js'></script>
<script src='spec/ui/preset/wikipedia.js'></script>
<script src='spec/ui/fields/access.js'></script>
<script src='spec/ui/fields/localized.js'></script>
<script src='spec/ui/fields/wikipedia.js'></script>
<script src='spec/services/mapillary.js'></script>
<script src='spec/services/nominatim.js'></script>
......
describe('iD.ui.preset.access', function() {
describe('access', function() {
var selection, field;
beforeEach(function() {
selection = d3.select(document.createElement('div'));
field = iD().presets(iD.data.presets).presets().field('access');
});
it('creates inputs for a variety of modes of access', function() {
var access = iD.ui.preset.access(field);
var access = 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);
......@@ -17,20 +16,20 @@ describe('iD.ui.preset.access', function() {
});
it('does not include "yes", "designated", "dismount" options for general access (#934), (#2213)', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
expect(_.map(access.options('access'), 'value')).not.to.include('yes');
expect(_.map(access.options('access'), 'value')).not.to.include('designated');
expect(_.map(access.options('access'), 'value')).not.to.include('dismount');
});
it('does include a "dismount" option for bicycles (#2726)', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
expect(_.map(access.options('bicycle'), 'value')).to.include('dismount');
expect(_.map(access.options('foot'), 'value')).not.to.include('dismount');
});
it('sets foot placeholder to "yes" for steps and pedestrian', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
access.tags({highway: 'steps'});
......@@ -41,7 +40,7 @@ describe('iD.ui.preset.access', function() {
});
it('sets foot placeholder to "designated" for footways', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
access.tags({highway: 'footway'});
......@@ -49,7 +48,7 @@ describe('iD.ui.preset.access', function() {
});
it('sets bicycle placeholder to "designated" for cycleways', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
access.tags({highway: 'cycleway'});
......@@ -57,7 +56,7 @@ describe('iD.ui.preset.access', function() {
});
it('sets horse placeholder to "designated" for bridleways', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
access.tags({highway: 'bridleway'});
......@@ -65,7 +64,7 @@ describe('iD.ui.preset.access', function() {
});
it('sets motor_vehicle placeholder to "no" for footways, steps, pedestrian, cycleway, bridleway, and path', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
['footway', 'steps', 'pedestrian', 'cycleway', 'bridleway', 'path'].forEach(function(value) {
access.tags({highway: value});
......@@ -74,7 +73,7 @@ describe('iD.ui.preset.access', function() {
});
it('sets motor_vehicle placeholder to "yes" for various other highway tags', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
['residential', 'motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'service',
'unclassified', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link'].forEach(function(value) {
......@@ -84,7 +83,7 @@ describe('iD.ui.preset.access', function() {
});
it('overrides a "yes" or "designated" placeholder with more specific access tag (#2213)', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
access.tags({highway: 'service', access: 'emergency'});
......@@ -95,7 +94,7 @@ describe('iD.ui.preset.access', function() {
});
it('overrides a "no" placeholder with more specific access tag (#2763)', function() {
var access = iD.ui.preset.access(field);
var access = access(field);
selection.call(access);
access.tags({highway: 'cycleway', access: 'destination'});
......
describe('iD.ui.preset.localized', function() {
describe('localized', function() {
var selection, field;
beforeEach(function() {
......@@ -7,7 +7,7 @@ describe('iD.ui.preset.localized', function() {
});
it('adds a blank set of fields when the + button is clicked', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
expect(selection.selectAll('.localized-lang').size()).to.equal(1);
......@@ -15,7 +15,7 @@ describe('iD.ui.preset.localized', function() {
});
it('doesn\'t create a tag when the value is empty', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
......@@ -29,7 +29,7 @@ describe('iD.ui.preset.localized', function() {
});
it('doesn\'t create a tag when the name is empty', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
......@@ -43,7 +43,7 @@ describe('iD.ui.preset.localized', function() {
});
it('creates a tag after setting language then value', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
......@@ -59,7 +59,7 @@ describe('iD.ui.preset.localized', function() {
});
it('creates a tag after setting value then language', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
happen.click(selection.selectAll('.localized-add').node());
......@@ -75,7 +75,7 @@ describe('iD.ui.preset.localized', function() {
});
it('changes an existing language', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
localized.tags({'name:de': 'Value'});
......@@ -90,7 +90,7 @@ describe('iD.ui.preset.localized', function() {
});
it('ignores similar keys like `old_name`', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
localized.tags({'old_name:de': 'Value'});
......@@ -99,7 +99,7 @@ describe('iD.ui.preset.localized', function() {
});
it('removes the tag when the language is emptied', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
localized.tags({'name:de': 'Value'});
......@@ -112,7 +112,7 @@ describe('iD.ui.preset.localized', function() {
});
it('removes the tag when the value is emptied', function() {
var localized = iD.ui.preset.localized(field, {});
var localized = localized(field, {});
selection.call(localized);
localized.tags({'name:de': 'Value'});
......
describe('iD.ui.preset.wikipedia', function() {
describe('wikipedia', function() {
var entity, context, selection, field, wikiDelay, selectedId;
function wikidataStub() {
......@@ -40,7 +40,7 @@ describe('iD.ui.preset.wikipedia', function() {
it('recognizes lang:title format', function() {
var wikipedia = iD.ui.preset.wikipedia(field, context);
var wikipedia = wikipedia(field, context);
selection.call(wikipedia);
wikipedia.tags({wikipedia: 'en:Title'});
expect(selection.selectAll('.wiki-lang').value()).to.equal('English');
......@@ -49,7 +49,7 @@ describe('iD.ui.preset.wikipedia', function() {
});
it('sets language, value, wikidata', function() {
var wikipedia = iD.ui.preset.wikipedia(field, context).entity(entity);
var wikipedia = wikipedia(field, context).entity(entity);
wikipedia.on('change', changeTags);
selection.call(wikipedia);
......@@ -74,7 +74,7 @@ describe('iD.ui.preset.wikipedia', function() {
});
it('recognizes pasted URLs', function() {
var wikipedia = iD.ui.preset.wikipedia(field, context).entity(entity);
var wikipedia = wikipedia(field, context).entity(entity);
wikipedia.on('change', changeTags);
selection.call(wikipedia);
......@@ -85,10 +85,10 @@ describe('iD.ui.preset.wikipedia', function() {
});
it('preserves existing language', function() {
selection.call(iD.ui.preset.wikipedia(field, context));
selection.call(wikipedia(field, context));
selection.selectAll('.wiki-lang').value('Deutsch');
var wikipedia = iD.ui.preset.wikipedia(field, context);
var wikipedia = wikipedia(field, context);
selection.call(wikipedia);
wikipedia.tags({});
......@@ -96,7 +96,7 @@ describe('iD.ui.preset.wikipedia', function() {
});
it('does not set delayed wikidata tag if wikipedia field has changed', function(done) {
var wikipedia = iD.ui.preset.wikipedia(field, context).entity(entity);
var wikipedia = wikipedia(field, context).entity(entity);
wikipedia.on('change', changeTags);
selection.call(wikipedia);
wikiDelay = 20;
......@@ -127,7 +127,7 @@ describe('iD.ui.preset.wikipedia', function() {
});
it('does not set delayed wikidata tag if selected entity has changed', function(done) {
var wikipedia = iD.ui.preset.wikipedia(field, context).entity(entity);
var wikipedia = wikipedia(field, context).entity(entity);
wikipedia.on('change', changeTags);
selection.call(wikipedia);
wikiDelay = 20;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment