This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not scroll to the capture area when it's completely visible in the…
… current view port
- Loading branch information
Vladimir Alaev
committed
May 7, 2015
1 parent
2a97cb3
commit 1d40d37
Showing
3 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict'; | ||
|
||
var assert = require('chai').assert, | ||
Rect = require('../lib/browser/client-scripts/rect').Rect; | ||
|
||
describe('Rect', function() { | ||
describe('constructor', function() { | ||
it('should create instance using width/height properties', function() { | ||
assert.doesNotThrow(function() { | ||
return new Rect({ | ||
top: 10, | ||
left: 20, | ||
width: 100, | ||
height: 100 | ||
}); | ||
}); | ||
}); | ||
|
||
it('should create instance using bottom/right properties', function() { | ||
assert.doesNotThrow(function() { | ||
return new Rect({ | ||
top: 10, | ||
left: 20, | ||
bottom: 100, | ||
right: 100 | ||
}); | ||
}); | ||
}); | ||
|
||
it('should fail when there are no bottom/right or width/height properties', function() { | ||
assert.throws(function() { | ||
return new Rect({top: 10, left: 20}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('rectInside', function() { | ||
var rect = new Rect({ | ||
top: 10, | ||
left: 20, | ||
width: 100, | ||
height: 100 | ||
}); | ||
|
||
it('should return true when rect is inside', function() { | ||
assert.isTrue(rect.rectInside( | ||
new Rect({ | ||
top: rect.top + 10, | ||
left: rect.left + 10, | ||
width: rect.width - 50, | ||
height: rect.height - 50 | ||
}) | ||
)); | ||
}); | ||
|
||
it('should return false when rect is not inside', function() { | ||
assert.isFalse(rect.rectInside( | ||
new Rect({ | ||
top: rect.top - 5, | ||
left: rect.left - 5, | ||
width: rect.width, | ||
height: rect.width | ||
}) | ||
)); | ||
}); | ||
}); | ||
}); |