Skip to content

Instantly share code, notes, and snippets.

@justinvdm
Created June 12, 2013 10:09
Show Gist options
  • Save justinvdm/5764179 to your computer and use it in GitHub Desktop.
Save justinvdm/5764179 to your computer and use it in GitHub Desktop.
diff --git a/go/base/static/js/test/tests/components/views.test.js b/go/base/static/js/test/tests/components/views.test.js
index 2342634..30c9f56 100644
--- a/go/base/static/js/test/tests/components/views.test.js
+++ b/go/base/static/js/test/tests/components/views.test.js
@@ -17,6 +17,12 @@ describe("go.components.views", function() {
var label;
+ var assertOffset = function(el, expectedOffset) {
+ var offset = $(el).offset();
+ assert.closeTo(offset.top, expectedOffset.top, 1);
+ assert.closeTo(offset.left, expectedOffset.left, 1);
+ };
+
beforeEach(function() {
$('#dummy')
.width(200)
@@ -40,9 +46,7 @@ describe("go.components.views", function() {
it("should position the label at the given position", function() {
label.render();
- assert.deepEqual(
- $('#dummy .label').offset(),
- {left: 21, top: 73});
+ assertOffset('#dummy .label', {left: 21, top: 73});
});
it("should render the given text", function() {
@peterp
Copy link

peterp commented Jun 12, 2013

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment