This repository has been archived by the owner on Mar 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
99 additions
and
53 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
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,48 @@ | ||
core = require "core.coffee" | ||
_u = require "jquery.ext.coffee" | ||
utils = require "./jasmine-utils.coffee" | ||
SequenceDiagramLayout = require "SequenceDiagramLayout.coffee" | ||
SequenceDiagramBuilder = require "SequenceDiagramBuilder.coffee" | ||
|
||
describe "SequenceParticipant", -> | ||
|
||
div = utils.div this | ||
|
||
beforeEach -> | ||
@layout = new SequenceDiagramLayout | ||
@builder = new SequenceDiagramBuilder | ||
|
||
describe "one participant", -> | ||
beforeEach -> | ||
@diagram = @builder.build """ | ||
@found "a" | ||
""" | ||
div.append @diagram | ||
@layout.layout @diagram | ||
|
||
it "is calculated for width", -> | ||
p = @diagram.find(".participant:eq(0)") | ||
expect(p.outerWidth()).toBe 2 + 0 + 4 + 88 + 4 + 0 + 2 | ||
|
||
it "is calculated for height", -> | ||
p = @diagram.find(".participant:eq(0)") | ||
n = p.find(".name") | ||
# 1.2 is from https://developer.mozilla.org/en-US/docs/Web/CSS/line-height | ||
lh = Math.round(parseInt(n.css("font-size")) * 1.2) # estimated line-height | ||
|
||
expect(p.outerHeight()).toBe 2 + 8 + 0 + lh + 0 + 8 + 2 | ||
|
||
describe "two participants", -> | ||
beforeEach -> | ||
@diagram = @builder.build """ | ||
@found "0123456789abcdef0123456789abcdef", -> | ||
@message "hi", "You" | ||
""" | ||
div.append @diagram | ||
@layout.layout @diagram | ||
|
||
it "is aligned at bottom", -> | ||
p0 = @diagram.find(".participant:eq(0)") | ||
p1 = @diagram.find(".participant:eq(1)") | ||
|
||
expect(utils.bottom p0).toBe utils.bottom p1 |
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