form_datetime.js 994 B

123456789101112131415161718192021222324
  1. QUnit.test("DateTime timepicker focuses hours", assert => {
  2. var form = $('#forms')
  3. var el = $('<div></div>').attr('id', 'form1')
  4. el.appendTo(form)
  5. new App.ControllerForm({
  6. el: el,
  7. model: {
  8. configure_attributes: [
  9. { name: 'datetime1', display: 'Datetime1', tag: 'datetime', null: true },
  10. { name: 'datetime2', display: 'Datetime2', tag: 'datetime', null: true, disabled: true },
  11. { name: 'date3', display: 'Date3', tag: 'date', null: true, disabled: true },
  12. ]
  13. },
  14. autofocus: true
  15. });
  16. assert.equal(el.find('[data-name=datetime1] [data-item=date]')[0].disabled, false)
  17. assert.equal(el.find('[data-name=datetime1] [data-item=time]')[0].disabled, false)
  18. assert.equal(el.find('[data-name=datetime2] [data-item=date]')[0].disabled, true)
  19. assert.equal(el.find('[data-name=datetime2] [data-item=time]')[0].disabled, true)
  20. assert.equal(el.find('[data-name=date3] [data-item=date]')[0].disabled, true)
  21. });