mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 16:49:40 +02:00
Clean up and test relation sorting code.
This commit is contained in:
@@ -470,4 +470,20 @@ describe('iD.Relation', function () {
|
||||
expect(r.multipolygon(g)).to.eql([[[a.loc, b.loc, c.loc]]]);
|
||||
});
|
||||
});
|
||||
|
||||
describe(".creationOrder comparator", function () {
|
||||
specify("orders existing relations newest-first", function () {
|
||||
var a = iD.Relation({ id: 'r1' }),
|
||||
b = iD.Relation({ id: 'r2' });
|
||||
expect(iD.Relation.creationOrder(a, b)).to.be.above(0);
|
||||
expect(iD.Relation.creationOrder(b, a)).to.be.below(0);
|
||||
});
|
||||
|
||||
specify("orders new relations newest-first", function () {
|
||||
var a = iD.Relation({ id: 'r-1' }),
|
||||
b = iD.Relation({ id: 'r-2' });
|
||||
expect(iD.Relation.creationOrder(a, b)).to.be.above(0);
|
||||
expect(iD.Relation.creationOrder(b, a)).to.be.below(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user