|
1 | 1 | var Plotly = require('@lib/index');
|
2 | 2 | var Lib = require('@src/lib');
|
3 | 3 |
|
| 4 | + |
4 | 5 | describe('plot schema', function() {
|
5 | 6 | 'use strict';
|
6 | 7 |
|
@@ -112,17 +113,31 @@ describe('plot schema', function() {
|
112 | 113 | expect(list).toEqual(astrs);
|
113 | 114 | });
|
114 | 115 |
|
115 |
| - it('layout.annotations and layout.shapes should contain `items`', function() { |
116 |
| - var astrs = ['annotations', 'shapes']; |
| 116 | + it('should convert _isLinkedToArray attributes to items object', function() { |
| 117 | + var astrs = [ |
| 118 | + 'annotations', 'shapes', |
| 119 | + 'xaxis.rangeselector.buttons', 'yaxis.rangeselector.buttons' |
| 120 | + ]; |
117 | 121 |
|
118 | 122 | astrs.forEach(function(astr) {
|
119 |
| - expect( |
120 |
| - isPlainObject( |
121 |
| - Lib.nestedProperty( |
122 |
| - plotSchema.layout.layoutAttributes, astr |
123 |
| - ).get().items |
124 |
| - ) |
125 |
| - ).toBe(true); |
| 123 | + var np = Lib.nestedProperty( |
| 124 | + plotSchema.layout.layoutAttributes, astr |
| 125 | + ); |
| 126 | + |
| 127 | + var name = np.parts[np.parts.length - 1], |
| 128 | + itemName = name.substr(0, name.length - 1); |
| 129 | + |
| 130 | + var itemsObj = np.get().items, |
| 131 | + itemObj = itemsObj[itemName]; |
| 132 | + |
| 133 | + expect(isPlainObject(itemsObj)).toBe(true); |
| 134 | + expect(itemsObj.role).toBeUndefined(); |
| 135 | + expect(Object.keys(itemsObj).length).toEqual(1); |
| 136 | + expect(isPlainObject(itemObj)).toBe(true); |
| 137 | + expect(itemObj.role).toBe('object'); |
| 138 | + |
| 139 | + var role = np.get().role; |
| 140 | + expect(role).toEqual('object'); |
126 | 141 | });
|
127 | 142 | });
|
128 | 143 |
|
@@ -158,4 +173,5 @@ describe('plot schema', function() {
|
158 | 173 | }
|
159 | 174 | );
|
160 | 175 | });
|
| 176 | + |
161 | 177 | });
|
0 commit comments