Skip to content

Commit

Permalink
image: test that axis default constrain: 'domain' is applied to x axis
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerg committed Oct 29, 2019
1 parent 8ef17c3 commit d1eca2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/jasmine/tests/image_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,23 @@ describe('image smart layout defaults', function() {
gd = {};
gd.data = [{type: 'image', z: [[[255, 0, 0]]]}];
supplyAllDefaults(gd);
expect(gd._fullLayout.xaxis.constrain).toBe('domain');
expect(gd._fullLayout.yaxis.constrain).toBe('domain');
});

it('should constrain axes to domain even if another trace is present', function() {
gd = {};
gd.data = [{type: 'image', z: [[[255, 0, 0]]]}, {type: 'scatter', y: [5, 3, 2]}];
supplyAllDefaults(gd);
expect(gd._fullLayout.xaxis.constrain).toBe('domain');
expect(gd._fullLayout.yaxis.constrain).toBe('domain');
});

it('should NOT constrain axes to domain if it\'s already defined', function() {
gd.data = [{type: 'image', z: [[[255, 0, 0]]]}];
gd.layout = {yaxis: {constrain: false}};
gd.layout = {yaxis: {constrain: false}, xaxis: {constrain: false}};
supplyAllDefaults(gd);
expect(gd._fullLayout.xaxis.constrain).toBe(undefined);
expect(gd._fullLayout.yaxis.constrain).toBe(undefined);
});
});
Expand Down

0 comments on commit d1eca2c

Please sign in to comment.