form_skip_rendering.js 615 B

12345678910111213141516171819
  1. QUnit.test("form elements not rendered", assert => {
  2. $('#forms').append('<hr><h1>form elements check</h1><form id="form1"></form>')
  3. var el = $('#form1')
  4. new App.ControllerForm({
  5. el: el,
  6. model: {
  7. configure_attributes: [
  8. { name: 'shown', display: 'Shown', tag: 'input' },
  9. { name: 'hidden', display: 'Hidden', tag: 'input', skipRendering: true }
  10. ]
  11. },
  12. autofocus: true
  13. });
  14. assert.ok(el.find('input[name=shown]').get(0), 'control element is visible')
  15. assert.notOk(el.find('input[name=hidden]').get(0), 'element with skipRendering is not shown')
  16. });