Leaflet/spec/suites/geometry/TransformationSpec.js
John Firebaugh 01332ebead Omit "should" in spec descriptions
The rationale is this: the spec string describes the expected
behavior unconditionally. The code examples, on the other hand,
set up an expectation that is tested with the call to the expect
method. The code examples can violate the expectation, but the
spec string does not. The value of the spec string is as clearly
as possible describing the behavior. Including “should” in that
description adds no value. (From http://rubyspec.org/style_guide/)
2013-02-19 12:41:48 -08:00

32 lines
863 B
JavaScript

describe("Transformation", function() {
var t, p;
beforeEach(function() {
t = new L.Transformation(1, 2, 3, 4);
p = new L.Point(10, 20);
});
describe('#transform', function () {
it("performs a transformation", function() {
var p2 = t.transform(p, 2);
expect(p2).toEqual(new L.Point(24, 128));
});
it('assumes a scale of 1 if not specified', function () {
var p2 = t.transform(p);
expect(p2).toEqual(new L.Point(12, 64));
});
});
describe('#untransform', function () {
it("performs a reverse transformation", function() {
var p2 = t.transform(p, 2);
var p3 = t.untransform(p2, 2);
expect(p3).toEqual(p);
});
it('assumes a scale of 1 if not specified', function () {
var p2 = t.transform(p);
expect(t.untransform(new L.Point(12, 64))).toEqual(new L.Point(10, 20));
});
});
});