Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor drag box layer tests - Part 1 #2655

Merged
merged 15 commits into from
Aug 24, 2015
Merged

Refactor drag box layer tests - Part 1 #2655

merged 15 commits into from
Aug 24, 2015

Conversation

aicioara
Copy link
Contributor

Part of #2623

I will be doing multiple passes because I will get more context (and better sense of best practices) by refactoring other files. However, please flag anything that seems unusual.

As part of this:

  • Applied best practices from the wiki page
  • Factored out common code into beforeEach() clauses
  • No nested beforeEach()es
  • Added afterEach() to save some LOCs
  • Remade hierarchy as shown bellow
    screen shot 2015-08-20 at 4 28 31 pm

[NOQE] as no JS changes

@aicioara aicioara added the NOQE label Aug 19, 2015
@jtlan jtlan changed the title Refactor drag box layer Refactor drag box layer tests Aug 19, 2015
let bounds = dbl.bounds();
assert.deepEqual(bounds.topLeft, startPoint, "top-left point was set correctly");
assert.deepEqual(bounds.bottomRight, endPoint, "bottom-right point was set correctly");
describe("DragBoxLayer - basics", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a better description?

@ztsai ztsai added this to the v1.8.0 milestone Aug 19, 2015
let target = dbl.background();
TestMethods.triggerFakeDragSequence(target, targetPoint, targetPoint);
afterEach(() => {
svg.remove();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will get called even the test fails; I remember being told that this is not desired

@ztsai
Copy link
Contributor

ztsai commented Aug 20, 2015

just wondering, is it necessary to put DragBoxLayer as a prefix in all describe blocks? after all it's the name of the parent block

@aicioara aicioara removed the -1 label Aug 20, 2015
@aicioara aicioara assigned ztsai and unassigned aicioara Aug 20, 2015
@aicioara
Copy link
Contributor Author

Amazing review. Thank you very much. Managed to apply suggestions from here to my other refactor PRs.


it("can get and set the detection radius", () => {
assert.strictEqual(dbl.detectionRadius(), 3, "there is a default detection radius");
assert.doesNotThrow(() => dbl.detectionRadius(4), Error, "can set detection radius before anchoring");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"cannot set detection..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesNotThrow(). I got tricked by this 3 times while refactoring. The signature is a bit weird.

@ztsai ztsai added the -1 label Aug 21, 2015
@ztsai ztsai assigned aicioara and unassigned ztsai Aug 21, 2015
@aicioara aicioara removed the -1 label Aug 21, 2015
@aicioara aicioara assigned ztsai and unassigned aicioara Aug 21, 2015
@ztsai ztsai added +1 and removed Status: In CR labels Aug 24, 2015
@ztsai ztsai assigned aicioara and unassigned ztsai Aug 24, 2015
@ztsai ztsai modified the milestones: v1.10.0, v1.8.0, v1.9.0 Aug 24, 2015
@aicioara aicioara changed the title Refactor drag box layer tests Refactor drag box layer tests - Part 1 Aug 24, 2015
aicioara added a commit that referenced this pull request Aug 24, 2015
Refactor drag box layer tests - Part 1
@aicioara aicioara merged commit 9f28eb6 into develop Aug 24, 2015
@aicioara aicioara deleted the refactorDragBoxLayer branch August 24, 2015 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants