window.onload = function() { // model QUnit.test( "model ui basic tests", assert => { // load ref object App.Collection.loadAssets({ TicketState: { 1: { name: 'new', id: 1, updated_at: "2014-11-07T23:43:08.000Z", }, 2: { name: 'open', id: 2, updated_at: "2014-11-07T23:43:08.000Z", }, 3: { name: 'closed <>&', id: 3, updated_at: "2014-11-07T23:43:08.000Z", }, }, }) // create ticket var attribute1 = { name: 'date', display: 'date 1', tag: 'date', null: true }; App.Ticket.configure_attributes.push( attribute1 ) var attribute2 = { name: 'textarea', display: 'textarea 1', tag: 'textarea', null: true }; App.Ticket.configure_attributes.push( attribute2 ) var attribute3 = { name: 'link1', display: 'link 1', linktemplate: 'http://zammad.com', tag: 'input', null: true, translate: true }; App.Ticket.configure_attributes.push( attribute3 ) var attribute4 = { name: 'link2', display: 'link 1', linktemplate: 'http://zammad.com', tag: 'input', null: true }; App.Ticket.configure_attributes.push( attribute4 ) var ticket = new App.Ticket() ticket.load({ id: 1000, title: 'some title <>&', state_id: 2, updated_at: '2014-11-07T23:43:08.000Z', date: '2015-02-07', textarea: "some new\nline", link1: 'closed', link2: 'closed', }) App.i18n.set('en-us') assert.equal( App.viewPrint( ticket, 'id' ), 1000) assert.equal( App.viewPrint( ticket, 'title' ), 'some title <>&') assert.equal( App.viewPrint( ticket, 'state' ), 'open') assert.equal( App.viewPrint( ticket, 'state_id' ), 'open') assert.equal( App.viewPrint( ticket, 'not_existing' ), '-') assert.equal( App.viewPrint( ticket, 'updated_at' ), '') assert.equal( App.viewPrint( ticket, 'date' ), '02/07/2015') assert.equal( App.viewPrint( ticket, 'textarea' ), '