|
240 | 240 | done(); |
241 | 241 | }); |
242 | 242 | }); |
| 243 | + |
| 244 | + |
| 245 | + it("value is changed on Enter", function(done) { |
| 246 | + var dropdownlist = new DropDownList(select, { |
| 247 | + close: function(e) { e.preventDefault(); }, |
| 248 | + height: CONTAINER_HEIGHT, |
| 249 | + animation: false, |
| 250 | + filter: "startswith", |
| 251 | + dataTextField: "text", |
| 252 | + dataValueField: "value", |
| 253 | + dataSource: createAsyncDataSource(), |
| 254 | + change: function (e) { |
| 255 | + assert.equal(e.sender.value(), "5"); |
| 256 | + done(); |
| 257 | + }, |
| 258 | + virtual: { |
| 259 | + valueMapper: function(o) { o.success(o.value); }, |
| 260 | + itemHeight: 20 |
| 261 | + } |
| 262 | + }); |
| 263 | + |
| 264 | + dropdownlist.one("dataBound", function() { |
| 265 | + dropdownlist.filterInput.focus().val("Item 5"); |
| 266 | + dropdownlist.filterInput.trigger({ type: "keydown" }); |
| 267 | + |
| 268 | + dropdownlist.one("dataBound", function (){ |
| 269 | + dropdownlist.filterInput.trigger({ type: "keydown", keyCode: kendo.keys.ENTER }); |
| 270 | + }); |
| 271 | + }); |
| 272 | + dropdownlist.open(); |
| 273 | + }); |
| 274 | + |
| 275 | + it("item is selected on DOWN", function(done) { |
| 276 | + var dropdownlist = new DropDownList(select, { |
| 277 | + close: function(e) { e.preventDefault(); }, |
| 278 | + height: CONTAINER_HEIGHT, |
| 279 | + animation: false, |
| 280 | + dataTextField: "text", |
| 281 | + dataValueField: "value", |
| 282 | + dataSource: createAsyncDataSource(), |
| 283 | + select: function (e) { |
| 284 | + assert.equal(e.dataItem.value, "1"); |
| 285 | + done(); |
| 286 | + }, |
| 287 | + virtual: { |
| 288 | + valueMapper: function(o) { o.success(o.value); }, |
| 289 | + itemHeight: 20 |
| 290 | + }, |
| 291 | + value: 0 |
| 292 | + }); |
| 293 | + |
| 294 | + dropdownlist.one("dataBound", function() { |
| 295 | + dropdownlist.wrapper.trigger({ type: "keydown", keyCode: kendo.keys.DOWN }); |
| 296 | + }); |
| 297 | + |
| 298 | + dropdownlist.open(); |
| 299 | + }); |
| 300 | + |
243 | 301 | }); |
244 | 302 | }()); |
0 commit comments