forked from Tribler/tribler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Tribler#149 from vandenheuvel/edge_thickness
Set link stroke width based on data transmitted over the link
- Loading branch information
Showing
4 changed files
with
68 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* This file tests the drawing.js file with unit tests | ||
*/ | ||
assert = require("assert"); | ||
drawing = require("../../../../widgets/trustpage/js/drawing.js"); | ||
|
||
describe("drawing.js", function () { | ||
describe("getStrokeWidth", function () { | ||
it("the middle of the interval is returned as the stroke width if the difference is 0", function () { | ||
var data = { | ||
"min_transmission": 100, | ||
"max_transmission": 100 | ||
}; | ||
assert.equal(6, drawing.getStrokeWidth(null, data)); | ||
}); | ||
}); | ||
describe("getStrokeWidth", function () { | ||
it("the function returns the correct width on sample data", function () { | ||
var data = { | ||
"min_transmission": 20, | ||
"max_transmission": 100 | ||
}; | ||
var link = { | ||
"amount_up": 15, | ||
"amount_down": 35 | ||
}; | ||
assert.equal(5, drawing.getStrokeWidth(link, data)); | ||
}); | ||
}); | ||
}); |
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