Merge branch 'master' of github.com:systemed/iD into create-multipolygon

This commit is contained in:
Ansis Brammanis
2013-04-04 16:39:00 -04:00
28 changed files with 7034 additions and 21859 deletions
+19
View File
@@ -87,3 +87,22 @@ clean:
translations:
node data/update_locales
D3_FILES = \
node_modules/d3/src/start.js \
node_modules/d3/src/arrays/index.js \
node_modules/d3/src/behavior/behavior.js \
node_modules/d3/src/behavior/zoom.js \
node_modules/d3/src/core/index.js \
node_modules/d3/src/event/index.js \
node_modules/d3/src/geo/mercator.js \
node_modules/d3/src/geo/path.js \
node_modules/d3/src/geo/stream.js \
node_modules/d3/src/geom/polygon.js \
node_modules/d3/src/selection/index.js \
node_modules/d3/src/transition/index.js \
node_modules/d3/src/xhr/index.js \
node_modules/d3/src/end.js
js/lib/d3.v3.js: $(D3_FILES)
node_modules/.bin/smash $(D3_FILES) > $@
+12 -2
View File
@@ -333,7 +333,8 @@ button {
display: inline-block;
height:40px;
border-radius:4px;
-webkit-transition: all 100ms;
/* Crashes Safari: https://github.com/systemed/iD/issues/1188 */
/*-webkit-transition: all 100ms;*/
-moz-transition: all 100ms;
-o-transition: all 100ms;
transition: all 100ms;
@@ -487,7 +488,6 @@ button.save.has-count .count::before {
.icon.back { background-position: -420px 0;}
.icon.forward { background-position: -440px 0;}
.icon.help { background-position: -460px 0;}
.icon.out-link { background-position: -480px 0;}
.icon.inspect.light { background-position: -220px -20px;}
.icon.geocode.light { background-position: -280px -20px;}
@@ -540,6 +540,11 @@ button[disabled] .icon.nearby { background-position: -340px -40px;}
.icon-operation-disabled-rotate { background-position: -180px -160px;}
.icon-operation-disabled-simplify { background-position: -200px -160px;}
/* Out link is special */
.icon.out-link { height: 14px; width: 14px; background-position: -500px 0;}
a:hover .icon.out-link { background-position: -500px -14px;}
/* Universal preset icons */
.icon.source { background-position: 0 -200px;}
@@ -1370,6 +1375,11 @@ div.combobox {
overflow: hidden;
}
.tag-help a {
margin-top: 5px;
display: block;
}
.grid-pane .tag-reference-wrap {
padding: 10px 0 20px 0;
}
+2 -2
View File
@@ -154,12 +154,12 @@ en:
no_documentation_key: There is no documentation available for this key
show_more: Show More
new_tag: New tag
view_on_osm: View on OSM →
view_on_osm: View on openstreetmap.org
editing_feature: "Editing {feature}"
additional: Additional tags
choose: Select feature type
results: "{n} results for {search}"
reference: View on OpenStreetMap Wiki
reference: View on OpenStreetMap Wiki
back_tooltip: Change feature type
background:
title: Background
+1979 -155
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -668,6 +668,9 @@ en:
railway/rail:
name: Rail
terms: ""
railway/station:
name: Railway Station
terms: ""
railway/subway:
name: Subway
terms: ""
+12
View File
@@ -2702,6 +2702,18 @@
"terms": [],
"name": "Rail"
},
"railway/station": {
"icon": "rail",
"geometry": [
"point",
"vertex",
"area"
],
"tags": {
"railway": "station"
},
"name": "Railway Station"
},
"railway/subway": {
"icon": "railway-subway",
"fields": [
+12
View File
@@ -0,0 +1,12 @@
{
"icon": "rail",
"geometry": [
"point",
"vertex",
"area"
],
"tags": {
"railway": "station"
},
"name": "Railway Station"
}
+10 -1
View File
@@ -27,7 +27,16 @@ var sourceCore = yaml.load(fs.readFileSync('./data/core.yaml', 'utf8')),
asyncMap(resources, getResource, function(err, locales) {
if (err) return console.log(err);
var out = '';
var out = '/*\n' +
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' +
'\n' +
' THIS FILE IS GENERATED BY `make translations`. Don\'t make changes to it.\n' +
'\n' +
' Instead, edit the English strings in data/core.yaml, or contribute\n' +
' translations on https://www.transifex.com/projects/p/id-editor/.\n' +
'\n' +
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' +
' */\n';
var locale = _.merge(sourceCore, sourcePresets);
locales.forEach(function(l) {
locale = _.merge(locale, l);
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

+1 -1
View File
@@ -246,7 +246,7 @@ iD.Connection = function(context) {
if (off) return;
var scaleExtent = [16, 16],
s = projection.scale(),
s = projection.scale() * 2 * Math.PI,
tiles = d3.geo.tile()
.scaleExtent(scaleExtent)
.scale(s)
+4 -4
View File
@@ -49,14 +49,14 @@ iD.Background = function(backgroundType) {
// Update tiles based on current state of `projection`.
function background(selection) {
tile.scale(projection.scale())
tile.scale(projection.scale() * 2 * Math.PI)
.translate(projection.translate());
tileOrigin = [
projection.scale() / 2 - projection.translate()[0],
projection.scale() / 2 - projection.translate()[1]];
projection.scale() * Math.PI - projection.translate()[0],
projection.scale() * Math.PI - projection.translate()[1]];
z = Math.max(Math.log(projection.scale()) / Math.log(2) - 8, 0);
z = Math.max(Math.log(projection.scale() * 2 * Math.PI) / Math.log(2) - 8, 0);
render(selection);
}
+10 -10
View File
@@ -1,11 +1,11 @@
iD.Map = function(context) {
var dimensions = [1, 1],
dispatch = d3.dispatch('move', 'drawn'),
projection = d3.geo.mercator().scale(1024),
projection = d3.geo.mercator().scale(512 / Math.PI),
roundedProjection = iD.svg.RoundProjection(projection),
zoom = d3.behavior.zoom()
.translate(projection.translate())
.scale(projection.scale())
.scale(projection.scale() * 2 * Math.PI)
.scaleExtent([1024, 256 * Math.pow(2, 24)])
.on('zoom', zoomPan),
dblclickEnabled = true,
@@ -118,7 +118,7 @@ iD.Map = function(context) {
function zoomPan() {
if (d3.event && d3.event.sourceEvent.type === 'dblclick') {
if (!dblclickEnabled) {
zoom.scale(projection.scale())
zoom.scale(projection.scale() * 2 * Math.PI)
.translate(projection.translate());
return d3.event.sourceEvent.preventDefault();
}
@@ -133,7 +133,7 @@ iD.Map = function(context) {
projection
.translate(d3.event.translate)
.scale(d3.event.scale);
.scale(d3.event.scale / (2 * Math.PI));
var ascale = d3.event.scale;
var bscale = transformStart[0];
@@ -202,7 +202,7 @@ iD.Map = function(context) {
}
transformStart = [
projection.scale(),
projection.scale() * 2 * Math.PI,
projection.translate().slice()];
return map;
@@ -216,13 +216,13 @@ iD.Map = function(context) {
function pointLocation(p) {
var translate = projection.translate(),
scale = projection.scale();
scale = projection.scale() * 2 * Math.PI;
return [(p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale];
}
function locationPoint(l) {
var translate = projection.translate(),
scale = projection.scale();
scale = projection.scale() * 2 * Math.PI;
return [l[0] * scale + translate[0], l[1] * scale + translate[1]];
}
@@ -248,8 +248,8 @@ iD.Map = function(context) {
center = pxCenter(),
l = pointLocation(center);
scale = Math.max(1024, Math.min(256 * Math.pow(2, 24), scale));
projection.scale(scale);
zoom.scale(projection.scale());
projection.scale(scale / (2 * Math.PI));
zoom.scale(scale);
var t = projection.translate();
l = locationPoint(l);
t[0] += center[0] - l[0];
@@ -312,7 +312,7 @@ iD.Map = function(context) {
map.zoom = function(z) {
if (!arguments.length) {
return Math.max(Math.log(projection.scale()) / Math.LN2 - 8, 0);
return Math.max(Math.log(projection.scale() * 2 * Math.PI) / Math.LN2 - 8, 0);
}
if (setZoom(z)) {
+7 -3
View File
@@ -73,12 +73,16 @@ iD.ui.TagEditor = function(context, entity) {
.call(tagList, preset.id === 'other');
if (!entity.isNew()) {
tageditorpreset.append('div')
var osmLink = tageditorpreset.append('div')
.attr('class', 'col12 inspector-inner')
.append('a')
.attr('href', 'http://www.openstreetmap.org/browse/' + entity.type + '/' + entity.osmId())
.attr('target', '_blank')
.text(t('inspector.view_on_osm'));
.attr('target', '_blank');
osmLink.append('span')
.attr('class','icon icon-pre-text out-link');
osmLink.append('span').text(t('inspector.view_on_osm'));
}
tageditor.tags(tags);
+7 -2
View File
@@ -72,10 +72,15 @@ iD.ui.TagReference = function(entity, tag) {
.append('p')
.text(docs.description);
referenceBody
var wikiLink = referenceBody
.append('a')
.attr('target', '_blank')
.attr('href', 'http://wiki.openstreetmap.org/wiki/' + docs.title)
.attr('href', 'http://wiki.openstreetmap.org/wiki/' + docs.title);
wikiLink.append('span')
.attr('class','icon icon-pre-text out-link');
wikiLink.append('span')
.text(t('inspector.reference'));
});
+4908 -7971
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -20,8 +20,15 @@
],
"license": "WTFPL",
"devDependencies": {
"d3": "3",
"smash": "0.0",
"uglify-js": "~2.2.5",
"mocha": "~1.9",
"mocha-phantomjs": "~1.1.1",
"chai": "~1.4",
"sinon": "~1.6",
"sinon-chai": "~2.3.1",
"happen": "~0.1.2",
"glob": "~3.1.21",
"js-yaml": "~2.0.3",
"request": "~2.16.2",
+23 -12
View File
@@ -15,7 +15,7 @@
version="1.1"
inkscape:version="0.48.2 r9819"
sodipodi:docname="sprite.svg"
inkscape:export-filename="/Users/saman/work_repos/iD/img/sprite2x.png"
inkscape:export-filename="/Users/saman/work_repos/iD/img/sprite.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
@@ -38,22 +38,22 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="494.79901"
inkscape:cy="539.80312"
inkscape:zoom="16"
inkscape:cx="505.57911"
inkscape:cy="546.02445"
inkscape:document-units="px"
inkscape:current-layer="layer12"
showgrid="false"
showgrid="true"
inkscape:window-width="1483"
inkscape:window-height="804"
inkscape:window-x="287"
inkscape:window-y="65"
inkscape:window-x="293"
inkscape:window-y="0"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
showguides="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:snap-bbox="true"
inkscape:snap-nodes="true"
@@ -215,6 +215,10 @@
orientation="1,0"
position="500,553"
id="guide3440" />
<sodipodi:guide
orientation="1,0"
position="520,550"
id="guide5526" />
</sodipodi:namedview>
<metadata
id="metadata12398">
@@ -224,7 +228,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -2607,8 +2611,15 @@
</g>
<path
style="color:#000000;fill:#7092ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="M 490.5 4 L 490.5 5.5 L 491.5 6.5 L 487 11 L 487 12 L 488 13 L 489 13 L 493.5 8.5 L 494.5 9.5 L 496 9.5 L 496 6 L 496 4 L 494 4 L 490.5 4 z M 484 6 L 483 7 L 483 16 L 484 17 L 493 17 L 494 16 L 494 11 L 492 13 L 492 15 L 491 15 L 490 15 L 486 15 L 485 15 L 485 10 L 485 8 L 486 8 L 487 8 L 489 6 L 484 6 z "
transform="translate(25,-3.0624999e-6)"
id="path3404-8" />
d="m 532.5,1.9999969 0,1 1,1 -4.5,4.5000001 0,0.5 0,1 1.5,0 4.5,-4.5000001 1,1 1,0 0,-3.5 0,-1 -1,0 z m -6.5,1 -1,1 0,9.0000001 1,1 9,0 1,-1 0,-5 -2,2 0,2 -1,0 -1,0 -4,0 -1,0 0,-5.0000001 0,-2 1,0 1,0 2,-2 z"
id="path3404-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc" />
<path
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc"
inkscape:connector-curvature="0"
id="path5520"
d="m 532.5,15.999997 0,1 1,1 -4.5,4.5 0,0.5 0,1 1.5,0 4.5,-4.5 1,1 1,0 0,-3.5 0,-1 -1,0 z m -6.5,1 -1,1 0,9 1,1 9,0 1,-1 0,-5 -2,2 0,2 -1,0 -1,0 -4,0 -1,0 0,-5 0,-2 1,0 1,0 2,-2 z"
style="color:#000000;fill:#597be7;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 185 KiB

+6 -7
View File
@@ -3,17 +3,17 @@
<head>
<meta charset='utf-8'>
<title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css">
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="lib/mocha.js"></script>
<script src="lib/chai.js"></script>
<script src="lib/sinon.js"></script>
<script src="lib/sinon-chai.js"></script>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/sinon-chai/lib/sinon-chai.js"></script>
<script src="../node_modules/happen/src/happen.js"></script>
<script src="lib/bind-shim.js"></script>
<script src="lib/happen.js"></script>
<!-- include source files here... -->
<script src='../js/lib/lodash.js'></script>
@@ -233,7 +233,6 @@
<script src="spec/connection.js"></script>
<script src="spec/geo.js"></script>
<script src="spec/oauth.js"></script>
<script src="spec/taginfo.js"></script>
<script src="spec/util.js"></script>
<script src="spec/translation.js"></script>
+6 -6
View File
@@ -3,17 +3,17 @@
<head>
<meta charset='utf-8'>
<title>Mocha Tests</title>
<link rel="stylesheet" href="lib/mocha.css">
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="lib/mocha.js"></script>
<script src="lib/chai.js"></script>
<script src="lib/sinon.js"></script>
<script src="lib/sinon-chai.js"></script>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/sinon/pkg/sinon.js"></script>
<script src="../node_modules/sinon-chai/lib/sinon-chai.js"></script>
<script src="../node_modules/happen/src/happen.js"></script>
<script src="lib/bind-shim.js"></script>
<script src="lib/happen.js"></script>
<!-- include source files here... -->
<script src='../iD.min.js'></script>
-3767
View File
File diff suppressed because it is too large Load Diff
-123
View File
@@ -1,123 +0,0 @@
!(function(context, $) {
var h = {};
// Make inheritance bearable: clone one level of properties
function extend(child, parent) {
for (var property in parent) {
if (typeof child[property] == 'undefined') {
child[property] = parent[property];
}
}
return child;
}
h.once = function(x, o) {
var evt;
if (o.type.slice(0, 3) === 'key') {
if (typeof Event === 'function') {
evt = new Event(o.type);
evt.keyCode = o.keyCode || 0;
evt.charCode = o.charCode || 0;
evt.shiftKey = o.shiftKey || false;
evt.metaKey = o.metaKey || false;
evt.ctrlKey = o.ctrlKey || false;
evt.altKey = o.altKey || false;
} else {
evt = document.createEvent('KeyboardEvent');
// https://developer.mozilla.org/en/DOM/event.initKeyEvent
// https://developer.mozilla.org/en/DOM/KeyboardEvent
evt[(evt.initKeyEvent) ? 'initKeyEvent'
: 'initKeyboardEvent'](
o.type, // in DOMString typeArg,
true, // in boolean canBubbleArg,
true, // in boolean cancelableArg,
null, // in nsIDOMAbstractView viewArg, Specifies UIEvent.view. This value may be null.
o.ctrlKey || false, // in boolean ctrlKeyArg,
o.altKey || false, // in boolean altKeyArg,
o.shiftKey || false, // in boolean shiftKeyArg,
o.metaKey || false, // in boolean metaKeyArg,
o.keyCode || 0, // in unsigned long keyCodeArg,
o.charCode || 0 // in unsigned long charCodeArg);
);
// Workaround for https://bugs.webkit.org/show_bug.cgi?id=16735
if (evt.ctrlKey != (o.ctrlKey || 0) ||
evt.altKey != (o.altKey || 0) ||
evt.shiftKey != (o.shiftKey || 0) ||
evt.metaKey != (o.metaKey || 0) ||
evt.keyCode != (o.keyCode || 0) ||
evt.charCode != (o.charCode || 0)) {
evt = document.createEvent('Event');
evt.initEvent(o.type, true, true);
evt.ctrlKey = o.ctrlKey || false;
evt.altKey = o.altKey || false;
evt.shiftKey = o.shiftKey || false;
evt.metaKey = o.metaKey || false;
evt.keyCode = o.keyCode || 0;
evt.charCode = o.charCode || 0;
}
}
} else {
evt = document.createEvent('MouseEvents');
// https://developer.mozilla.org/en/DOM/event.initMouseEvent
evt.initMouseEvent(o.type,
true, // canBubble
true, // cancelable
window, // 'AbstractView'
o.clicks || 0, // click count
o.screenX || 0, // screenX
o.screenY || 0, // screenY
o.clientX || 0, // clientX
o.clientY || 0, // clientY
o.ctrlKey || 0, // ctrl
o.altKey || false, // alt
o.shiftKey || false, // shift
o.metaKey || false, // meta
o.button || false, // mouse button
null // relatedTarget
);
}
x.dispatchEvent(evt);
};
var shortcuts = ['click', 'mousedown', 'mouseup', 'mousemove',
'mouseover', 'mouseout', 'keydown', 'keyup', 'keypress'],
s, i = 0;
while (s = shortcuts[i++]) {
h[s] = (function(s) {
return function(x, o) {
h.once(x, extend(o || {}, { type: s }));
};
})(s);
}
h.dblclick = function(x, o) {
h.once(x, extend(o || {}, {
type: 'dblclick',
clicks: 2
}));
};
this.happen = h;
// Export for nodejs
if (typeof module !== 'undefined') {
module.exports = this.happen;
}
// Provide jQuery plugin
if ($ && $.fn) {
$.fn.happen = function(o) {
if (typeof o === 'string') {
o = { type: o };
}
for (var i = 0; i < this.length; i++) {
happen.once(this[i], o);
}
return this;
};
}
})(this, (typeof jQuery !== 'undefined') ? jQuery : null);
-227
View File
@@ -1,227 +0,0 @@
@charset "UTF-8";
body {
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 60px 50px;
}
#mocha ul, #mocha li {
margin: 0;
padding: 0;
}
#mocha ul {
list-style: none;
}
#mocha h1, #mocha h2 {
margin: 0;
}
#mocha h1 {
margin-top: 15px;
font-size: 1em;
font-weight: 200;
}
#mocha h1 a {
text-decoration: none;
color: inherit;
}
#mocha h1 a:hover {
text-decoration: underline;
}
#mocha .suite .suite h1 {
margin-top: 0;
font-size: .8em;
}
.hidden {
display: none;
}
#mocha h2 {
font-size: 12px;
font-weight: normal;
cursor: pointer;
}
#mocha .suite {
margin-left: 15px;
}
#mocha .test {
margin-left: 15px;
}
#mocha .test.pending:hover h2::after {
content: '(pending)';
font-family: arial;
}
#mocha .test.pass.medium .duration {
background: #C09853;
}
#mocha .test.pass.slow .duration {
background: #B94A48;
}
#mocha .test.pass::before {
content: '✓';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #00d6b2;
}
#mocha .test.pass .duration {
font-size: 9px;
margin-left: 5px;
padding: 2px 5px;
color: white;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#mocha .test.pass.fast .duration {
display: none;
}
#mocha .test.pending {
color: #0b97c4;
}
#mocha .test.pending::before {
content: '◦';
color: #0b97c4;
}
#mocha .test.fail {
color: #c00;
}
#mocha .test.fail pre {
color: black;
}
#mocha .test.fail::before {
content: '✖';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #c00;
}
#mocha .test pre.error {
color: #c00;
max-height: 300px;
overflow: auto;
}
#mocha .test pre {
display: inline-block;
font: 12px/1.5 monaco, monospace;
margin: 5px;
padding: 15px;
border: 1px solid #eee;
border-bottom-color: #ddd;
-webkit-border-radius: 3px;
-webkit-box-shadow: 0 1px 3px #eee;
-moz-border-radius: 3px;
-moz-box-shadow: 0 1px 3px #eee;
}
#mocha .test h2 {
position: relative;
}
#mocha .test a.replay {
position: absolute;
top: 3px;
right: -20px;
text-decoration: none;
vertical-align: middle;
display: block;
width: 15px;
height: 15px;
line-height: 15px;
text-align: center;
background: #eee;
font-size: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-transition: opacity 200ms;
-moz-transition: opacity 200ms;
transition: opacity 200ms;
opacity: 0.2;
color: #888;
}
#mocha .test:hover a.replay {
opacity: 1;
}
#mocha-report.pass .test.fail {
display: none;
}
#mocha-report.fail .test.pass {
display: none;
}
#mocha-error {
color: #c00;
font-size: 1.5 em;
font-weight: 100;
letter-spacing: 1px;
}
#mocha-stats {
position: fixed;
top: 15px;
right: 10px;
font-size: 12px;
margin: 0;
color: #888;
}
#mocha-stats .progress {
float: right;
padding-top: 0;
}
#mocha-stats em {
color: black;
}
#mocha-stats a {
text-decoration: none;
color: inherit;
}
#mocha-stats a:hover {
border-bottom: 1px solid #eee;
}
#mocha-stats li {
display: inline-block;
margin: 0 5px;
list-style: none;
padding-top: 11px;
}
code .comment { color: #ddd }
code .init { color: #2F6FAD }
code .string { color: #5890AD }
code .keyword { color: #8A6343 }
code .number { color: #2F6FAD }
-5299
View File
File diff suppressed because it is too large Load Diff
-106
View File
@@ -1,106 +0,0 @@
(function (sinonChai) {
"use strict";
// Module systems magic dance.
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
// NodeJS
module.exports = sinonChai;
} else if (typeof define === "function" && define.amd) {
// AMD
define(function () {
return sinonChai;
});
} else {
// Other environment (usually <script> tag): plug in to global chai instance directly.
chai.use(sinonChai);
}
}(function sinonChai(chai, utils) {
"use strict";
var slice = Array.prototype.slice;
function isSpy(putativeSpy) {
return typeof putativeSpy === "function" &&
typeof putativeSpy.getCall === "function" &&
typeof putativeSpy.calledWithExactly === "function";
}
function isCall(putativeCall) {
return putativeCall && isSpy(putativeCall.proxy);
}
function assertCanWorkWith(assertion) {
if (!isSpy(assertion._obj) && !isCall(assertion._obj)) {
throw new TypeError(utils.inspect(assertion._obj) + " is not a spy or a call to a spy!");
}
}
function getMessages(spy, action, nonNegatedSuffix, always, args) {
var verbPhrase = always ? "always have " : "have ";
nonNegatedSuffix = nonNegatedSuffix || "";
spy = spy.proxy || spy;
function printfArray(array) {
return spy.printf.apply(spy, array);
}
return {
affirmative: printfArray(["expected %n to " + verbPhrase + action + nonNegatedSuffix].concat(args)),
negative: printfArray(["expected %n to not " + verbPhrase + action].concat(args))
};
}
function sinonProperty(name, action, nonNegatedSuffix) {
utils.addProperty(chai.Assertion.prototype, name, function () {
assertCanWorkWith(this);
var messages = getMessages(this._obj, action, nonNegatedSuffix, false);
this.assert(this._obj[name], messages.affirmative, messages.negative);
});
}
function createSinonMethodHandler(sinonName, action, nonNegatedSuffix) {
return function () {
assertCanWorkWith(this);
var alwaysSinonMethod = "always" + sinonName[0].toUpperCase() + sinonName.substring(1);
var shouldBeAlways = utils.flag(this, "always") && typeof this._obj[alwaysSinonMethod] === "function";
var sinonMethod = shouldBeAlways ? alwaysSinonMethod : sinonName;
var messages = getMessages(this._obj, action, nonNegatedSuffix, shouldBeAlways, slice.call(arguments));
this.assert(this._obj[sinonMethod].apply(this._obj, arguments), messages.affirmative, messages.negative);
};
}
function sinonMethodAsProperty(name, action, nonNegatedSuffix) {
var handler = createSinonMethodHandler(name, action, nonNegatedSuffix);
utils.addProperty(chai.Assertion.prototype, name, handler);
}
function exceptionalSinonMethod(chaiName, sinonName, action, nonNegatedSuffix) {
var handler = createSinonMethodHandler(sinonName, action, nonNegatedSuffix);
utils.addMethod(chai.Assertion.prototype, chaiName, handler);
}
function sinonMethod(name, action, nonNegatedSuffix) {
exceptionalSinonMethod(name, name, action, nonNegatedSuffix);
}
utils.addProperty(chai.Assertion.prototype, "always", function () {
utils.flag(this, "always", true);
});
sinonProperty("called", "been called", " at least once, but it was never called");
sinonProperty("calledOnce", "been called exactly once", ", but it was called %c%C");
sinonProperty("calledTwice", "been called exactly twice", ", but it was called %c%C");
sinonProperty("calledThrice", "been called exactly thrice", ", but it was called %c%C");
sinonMethodAsProperty("calledWithNew", "been called with new");
sinonMethod("calledBefore", "been called before %1");
sinonMethod("calledAfter", "been called after %1");
sinonMethod("calledOn", "been called with %1 as this", ", but it was called with %t instead");
sinonMethod("calledWith", "been called with arguments %*", "%C");
sinonMethod("calledWithExactly", "been called with exact arguments %*", "%C");
sinonMethod("returned", "returned %1");
exceptionalSinonMethod("thrown", "threw", "thrown %1");
}));
-4153
View File
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -1,15 +1,17 @@
describe("iD.actions.Move", function() {
var projection = d3.geo.mercator().scale(250 / Math.PI);
describe("#disabled", function() {
it("returns falsy by default", function() {
var node = iD.Node({loc: [0, 0]}),
action = iD.actions.Move([node.id], [0, 0], d3.geo.mercator()),
action = iD.actions.Move([node.id], [0, 0], projection),
graph = iD.Graph([node]);
expect(action.disabled(graph)).not.to.be.ok;
});
it("returns 'incomplete_relation' for an incomplete relation", function() {
var relation = iD.Relation({members: [{id: 1}]}),
action = iD.actions.Move([relation.id], [0, 0], d3.geo.mercator()),
action = iD.actions.Move([relation.id], [0, 0], projection),
graph = iD.Graph([relation]);
expect(action.disabled(graph)).to.equal('incomplete_relation');
});
@@ -17,7 +19,7 @@ describe("iD.actions.Move", function() {
it("returns falsy for a complete relation", function() {
var node = iD.Node({loc: [0, 0]}),
relation = iD.Relation({members: [{id: node.id}]}),
action = iD.actions.Move([relation.id], [0, 0], d3.geo.mercator()),
action = iD.actions.Move([relation.id], [0, 0], projection),
graph = iD.Graph([node, relation]);
expect(action.disabled(graph)).not.to.be.ok;
});
@@ -28,7 +30,6 @@ describe("iD.actions.Move", function() {
node2 = iD.Node({loc: [5, 10]}),
way = iD.Way({nodes: [node1.id, node2.id]}),
delta = [2, 3],
projection = d3.geo.mercator(),
graph = iD.actions.Move([way.id], delta, projection)(iD.Graph([node1, node2, way])),
loc1 = graph.entity(node1.id).loc,
loc2 = graph.entity(node2.id).loc;
@@ -42,7 +43,6 @@ describe("iD.actions.Move", function() {
var node = iD.Node({loc: [0, 0]}),
way = iD.Way({nodes: [node.id, node.id]}),
delta = [2, 3],
projection = d3.geo.mercator(),
graph = iD.actions.Move([way.id], delta, projection)(iD.Graph([node, way])),
loc = graph.entity(node.id).loc;
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
@@ -54,7 +54,6 @@ describe("iD.actions.Move", function() {
way1 = iD.Way({nodes: [node.id]}),
way2 = iD.Way({nodes: [node.id]}),
delta = [2, 3],
projection = d3.geo.mercator(),
graph = iD.actions.Move([way1.id, way2.id], delta, projection)(iD.Graph([node, way1, way2])),
loc = graph.entity(node.id).loc;
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
@@ -66,7 +65,6 @@ describe("iD.actions.Move", function() {
way = iD.Way({nodes: [node.id]}),
relation = iD.Relation({members: [{id: way.id}]}),
delta = [2, 3],
projection = d3.geo.mercator(),
graph = iD.actions.Move([relation.id], delta, projection)(iD.Graph([node, way, relation])),
loc = graph.entity(node.id).loc;
expect(loc[0]).to.be.closeTo( 1.440, 0.001);
+1 -1
View File
@@ -1,5 +1,5 @@
describe("iD.svg.LineString", function () {
var projection = d3.geo.mercator();
var projection = d3.geo.mercator().scale(250 / Math.PI);
it("returns an SVG path description for the entity's nodes", function () {
var a = iD.Node({loc: [0, 0]}),