aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Header.spec.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Header.spec.jsx')
-rw-r--r--tests/Header.spec.jsx81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/Header.spec.jsx b/tests/Header.spec.jsx
index cc8f954..18d61c5 100644
--- a/tests/Header.spec.jsx
+++ b/tests/Header.spec.jsx
@@ -121,6 +121,87 @@ describe('Header', () => {
121 }); 121 });
122 }); 122 });
123 123
124 it('carry disabled correctly', (done) => {
125 const picker = renderPicker({
126 disabledMinutes: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]
127 });
128 expect(picker.state.open).not.to.be.ok();
129 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
130 let header;
131 async.series([(next) => {
132 Simulate.click(input);
133 setTimeout(next, 100);
134 }, (next) => {
135 expect(picker.state.open).to.be(true);
136 header = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-input')[0];
137 expect(header).to.be.ok();
138 expect(ReactDOM.findDOMNode(header).value).to.be('01:02:03');
139 expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
140
141 ReactDOM.findDOMNode(header).value = '12:15:78';
142 Simulate.change(header);
143 setTimeout(next, 100);
144 }, (next) => {
145 expect(picker.state.open).to.be(true);
146 expect(ReactDOM.findDOMNode(header).className).to.contain('rc-time-picker-panel-input-invalid');
147 expect(ReactDOM.findDOMNode(header).value).to.be('12:15:78');
148 expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
149
150 ReactDOM.findDOMNode(header).value = '12:10:78';
151 Simulate.change(header);
152 setTimeout(next, 100);
153 }, (next) => {
154 expect(picker.state.open).to.be(true);
155 expect(ReactDOM.findDOMNode(header).value).to.be('12:11:18');
156 expect(ReactDOM.findDOMNode(input).value).to.be('12:11:18');
157
158 next();
159 }], () => {
160 done();
161 });
162 });
163
164 it('carry hidden correctly', (done) => {
165 const picker = renderPicker({
166 disabledMinutes: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22],
167 hideDisabledOptions: true
168 });
169 expect(picker.state.open).not.to.be.ok();
170 const input = TestUtils.scryRenderedDOMComponentsWithClass(picker, 'rc-time-picker-input')[0];
171 let header;
172 async.series([(next) => {
173 Simulate.click(input);
174 setTimeout(next, 100);
175 }, (next) => {
176 expect(picker.state.open).to.be(true);
177 header = TestUtils.scryRenderedDOMComponentsWithClass(picker.panelInstance, 'rc-time-picker-panel-input')[0];
178 expect(header).to.be.ok();
179 expect(ReactDOM.findDOMNode(header).value).to.be('01:02:03');
180 expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
181
182 ReactDOM.findDOMNode(header).value = '12:15:78';
183 Simulate.change(header);
184 setTimeout(next, 100);
185 }, (next) => {
186 expect(picker.state.open).to.be(true);
187 expect(ReactDOM.findDOMNode(header).className).to.contain('rc-time-picker-panel-input-invalid');
188 expect(ReactDOM.findDOMNode(header).value).to.be('12:15:78');
189 expect(ReactDOM.findDOMNode(input).value).to.be('01:02:03');
190
191 ReactDOM.findDOMNode(header).value = '12:10:78';
192 Simulate.change(header);
193 setTimeout(next, 100);
194 }, (next) => {
195 expect(picker.state.open).to.be(true);
196 expect(ReactDOM.findDOMNode(header).value).to.be('12:11:18');
197 expect(ReactDOM.findDOMNode(input).value).to.be('12:11:18');
198
199 next();
200 }], () => {
201 done();
202 });
203 });
204
124 it('check correctly', (done) => { 205 it('check correctly', (done) => {
125 const picker = renderPicker(); 206 const picker = renderPicker();
126 expect(picker.state.open).not.to.be.ok(); 207 expect(picker.state.open).not.to.be.ok();