2014-07-23 10:02:45 -04:00
|
|
|
LevelEditView = require 'views/editor/level/LevelEditView'
|
2014-06-17 16:40:12 -04:00
|
|
|
|
2014-06-30 22:16:26 -04:00
|
|
|
emptyLevel = {'_id': '53a0a1e2d9048dbc3a793c81', 'name': 'Emptiness', 'description': 'Tis nothing..', 'documentation': {'generalArticles': [], 'specificArticles': []}, 'scripts': [], 'thangs': [], 'systems': [], 'victory': {}, 'version': {'minor': 0, 'major': 0, 'isLatestMajor': true, 'isLatestMinor': true}, 'index': '5388f9ac9a904d0000d94f87', 'slug': 'emptiness', 'creator': '5388f9ac9a904d0000d94f87', 'original': '53a0a1e2d9048dbc3a793c81', 'watchers': ['5388f9ac9a904d0000d94f87'], '__v': 0, 'created': '2014-06-17T20:15:30.207Z', 'permissions': [{'access': 'owner', 'target': '5388f9ac9a904d0000d94f87'}]}
|
2014-06-17 16:40:12 -04:00
|
|
|
|
2014-07-23 10:02:45 -04:00
|
|
|
describe 'LevelEditView', ->
|
2014-06-17 16:40:12 -04:00
|
|
|
describe 'revert button', ->
|
|
|
|
it 'opens just one modal when you click it', ->
|
2014-07-23 10:02:45 -04:00
|
|
|
view = new LevelEditView({}, 'something')
|
2014-06-17 16:40:12 -04:00
|
|
|
request = jasmine.Ajax.requests.first()
|
2014-06-30 22:16:26 -04:00
|
|
|
request.response {status: 200, responseText: JSON.stringify(emptyLevel)}
|
2014-06-17 16:40:12 -04:00
|
|
|
view.render()
|
|
|
|
spyOn(view, 'openModalView')
|
|
|
|
view.$el.find('#revert-button').click()
|
2014-06-30 22:16:26 -04:00
|
|
|
expect(view.openModalView.calls.count()).toBe(1)
|