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

189 ordinal scale domain item ordering #1

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
87ab745
Reifying current default ordering logic with a passing test case and …
monfera Mar 25, 2016
a547482
Ensure that null / undefined removal is in place, even in the presenc…
monfera Mar 25, 2016
69bf832
Ensure that no errors arise from the possibility of broader order spe…
monfera Mar 25, 2016
3fd3cc0
Ensure that it adheres to the categories array even if it doesn't com…
monfera Mar 25, 2016
e2977c5
Adding attribute definitions: categorymode and categories; simplifyin…
monfera Mar 26, 2016
62c4ac5
Renaming of 'categories' to 'categorylist' (it was explicitly deleted…
monfera Mar 27, 2016
85d60d6
Minimal commit to demonstrate the working of categorymode = 'array'
monfera Mar 29, 2016
f6c40b6
Minimal change for implementing 'category ascending' and 'category de…
monfera Mar 31, 2016
e4f2167
factored out orderedCategories into a separate function
monfera Mar 31, 2016
03643fe
factored out orderedCategories into a separate function
monfera Mar 31, 2016
9c366ce
lint orderedCategories
monfera Mar 31, 2016
f626b08
#189 role: info
monfera Apr 7, 2016
2f939af
#189 updating preexisting test cases in line with PR feedback (if the…
monfera Apr 7, 2016
ce35e8b
#189 updating preexisting test cases so that order itself is checked;…
monfera Apr 7, 2016
262c747
#189 updating preexisting test cases: further updates to proper axis …
monfera Apr 7, 2016
5f33a7b
#189 updating preexisting test cases: further updates to proper axis …
monfera Apr 7, 2016
f4214cb
#189 adding a path for when categorymode is not in ['array', 'categor…
monfera Apr 8, 2016
cbc98fd
#189 updating test case with non-utilized categorylist elements at be…
monfera Apr 8, 2016
a806ca2
#189 test case with null value for a category we just want for an axi…
monfera Apr 8, 2016
5ad6b5c
#189 baseline test case based on codepen pointed to by @etpinard
monfera Apr 8, 2016
82076f2
#189 commented out categorymode value ascending/descending as it's no…
monfera Apr 9, 2016
6fb2871
#189 adding test cases for trace lines with mutually exclusive catego…
monfera Apr 9, 2016
616121b
#189 adding test cases for trace lines with partially overlapping, fu…
monfera Apr 9, 2016
89794c6
#189 adding test cases for combinations of category ordering and stac…
monfera Apr 9, 2016
849978e
#189 test case linting
monfera Apr 9, 2016
d6fad10
#189 adding missing docs and reducing assumptions
monfera Apr 9, 2016
7c355b8
#189 adding actual DOM axis tick order tests for a couple of less tri…
monfera Apr 9, 2016
8a2292c
#189 rewriting cateogory sorter to O(1) + one sort call
monfera Apr 9, 2016
9b01bcc
#189 rewriting cateogory sorter: extract out logic
monfera Apr 9, 2016
010451b
#189 rewriting cateogory sorter: switching to switch
monfera Apr 9, 2016
6c9d0b5
#189 rewriting cateogory sorter: misc. improvements
monfera Apr 9, 2016
166aeb4
#189 renaming for uniformity (predominantly createGraphDiv() seems to…
monfera Apr 12, 2016
e472e14
#189 initial round of coercions with test cases
monfera Apr 12, 2016
d16fe6b
#189 additional tests for categorymode coercions
monfera Apr 12, 2016
0314f37
#189 comment fix
monfera Apr 12, 2016
043ac1b
#189 PR feedback and linting
monfera Apr 12, 2016
b98bd65
#189 image based regression test JSONs
monfera Apr 12, 2016
e007f73
#189 reworking the order code because it converted numbers to strings…
monfera Apr 12, 2016
34a5054
#189 adding image based tests
monfera Apr 12, 2016
c6d44d9
#189 comment update
monfera Apr 12, 2016
44a0c3d
#189 switching from O(n) to O(log(N)) complexity unique insertion sort
monfera Apr 12, 2016
613fda3
#189 adding axis attributes to 3D plots
monfera Apr 12, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions test/jasmine/tests/calcdata_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ describe('calculated data and points', function() {

describe('domain alphanumerical category ordering', function() {

// TODO augment test cases with selection on the DOM to ensure that ticks are there in proper order

it('should output categories in ascending domain alphanumerical order', function() {

Plotly.plot(gd, [{x: ['c','a','e','b','d'], y: [15,11,12,13,14]}], { xaxis: {
Expand Down Expand Up @@ -223,8 +221,6 @@ describe('calculated data and points', function() {

it('should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categorylist', function() {

// The auto-range feature currently eliminates unutilized category ticks on the left/right edge

Plotly.plot(gd, [{x: ['c','a','e','b','d'], y: [15,11,12,13,14]}], { xaxis: {
type: 'category',
categorymode: 'array',
Expand All @@ -236,6 +232,14 @@ describe('calculated data and points', function() {
expect(gd.calcdata[0][2]).toEqual(jasmine.objectContaining({x: 6, y: 12}));
expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 1, y: 13}));
expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 4, y: 14}));

// The auto-range feature currently eliminates unused category ticks on the left/right axis tails.
// The below test case reifies this current behavior, and checks proper order of categories kept.

var domTickTexts = Array.prototype.slice.call(document.querySelectorAll('g.xtick'))
.map(function(e) {return e.__data__.text;});

expect(domTickTexts).toEqual(['b', 'x', 'a', 'd', 'z', 'e', 'c']); // y, q and k has no data points
Copy link
Owner Author

Choose a reason for hiding this comment

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

@etpinard a few questions regarding this type of test:

  1. I've used library-free querying of the DOM; I think it's good but let me know if I should import d3 for this purpose, or you could point out another test file as a pattern to follow.
  2. I haven't yet bumped into axes/ticks tests of this nature, where we query the DOM, which is downstream of the 'viewModel' testing this file mostly has but upstream of image based testing. Do we need such DOM based testing, and are there preexisting DOM tests I should instead use that ensure e.g. proper category or tracing order?
  3. If we need such tests, should I add similar ones for the other test cases in this file?

});

it('should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categorylist', function() {
Expand All @@ -255,6 +259,11 @@ describe('calculated data and points', function() {
expect(gd.calcdata[0][2]).toEqual(jasmine.objectContaining({x: 6, y: 12}));
expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 1, y: 13}));
expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 4, y: 14}));

var domTickTexts = Array.prototype.slice.call(document.querySelectorAll('g.xtick'))
.map(function(e) {return e.__data__.text;});

expect(domTickTexts).toEqual(['y', 'b', 'x', 'a', 'd', 'z', 'e', 'c']); // q, k has no data; y is null
Copy link
Owner Author

Choose a reason for hiding this comment

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

@etpinard Same question here.

});

it('should output categories in explicitly supplied order even if not all categories are present, and should interact with a null value orthogonally', function() {
Expand Down