Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ctid = ready = null
- addChecklistTemplate = (title) ->
- ct = new ca.model.ChecklistTemplateSchema.Schema()
- ct.title = title
- persistence.add ct
- ct.id
- addChecklistStepTemplate = (templateID, index, title) ->
- cst = new ca.model.ChecklistStepTemplateSchema.Schema()
- cst.checklistTemplate = templateID
- cst.index = index
- cst.text = title
- persistence.add cst
- beforeEach ->
- persistence.debug = false
- ca.model.Database.getInstance().init()
- ca.model.ChecklistTemplateSchema.Schema.all().destroyAll ->
- ca.model.ChecklistStepTemplateSchema.Schema.all().destroyAll ->
- ctid = addChecklistTemplate 'Checklist Template 1'
- addChecklistStepTemplate ctid, 1, 'Step 1'
- persistence.flush ->
- ready = true
- describe 'Checklist Template Table', ->
- table = null
- item = null
- value = null
- beforeEach ->
- waitsFor -> ready
- table = ca.model.ChecklistTemplateTable
- item = new table()
- afterEach ->
- table = item = value = null
- it 'should return a list of checklist templates', ->
- item.addEventListener table.EventType.LIST_LOADED, (event) -> value = event.value, false, this
- item.getChecklistTemplates()
- waitsFor -> value
- runs ->
- console.log value
- expect( value ).not.toBe null
- expect( value.length ).toBe 3
- it 'should return a checklist template by id', ->
- item.addEventListener table.EventType.ITEM_LOADED, (event) -> value = event.value, false, this
- item.getChecklistTemplate( ctid )
- waitsFor -> value
- runs ->
- console.log value
- expect( value ).not.toBe null
- expect( value instanceof ca.model.ChecklistTemplate ).toBe true
Add Comment
Please, Sign In to add comment