Created
November 24, 2011 11:39
-
-
Save ralfschimmel/1391158 to your computer and use it in GitHub Desktop.
Failtest sproutcore childview in collectionview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('sproutcore'); | |
require('sproutcore-touch'); | |
var set = SC.set, get = SC.get; | |
var tapEndWasCalled = true; | |
module("Touching handlebars tests", { | |
setup: function() { | |
console.group(' - Setup for new test'); | |
tapEndWasCalled = false; | |
}, | |
teardown: function() { | |
console.groupEnd(); | |
} | |
}); | |
test("View do not respond when child has not ", function() { | |
var application = SC.Application.create(); | |
var view = SC.CollectionView.create({ | |
tagName: "ul", | |
itemTagName: "li", | |
content: [{id: "one", innerId: "i-one", text: "blaat"}], | |
itemViewClass: SC.View.extend({ | |
tapOptions: { | |
numberOfRequiredTouches: 1 | |
}, | |
tapEnd: function(recognizer) { | |
tapEndWasCalled = true; | |
}, | |
template: SC.Handlebars.compile('<div> <span> {{#view SC.View}}<span {{bindAttr id="parentView.content.innerId"}}>{{parentView.content.text}}</span>{{/view}}</span> </div>') | |
}) | |
}); | |
SC.run(function(){ | |
view.append(); | |
}); | |
// var id =view.$().children()[0].id; | |
var element = $("#i-one"); | |
console.log('element found: '); | |
console.log(element); | |
var touchEvent; | |
touchEvent = new jQuery.Event(); | |
touchEvent.type='touchstart'; | |
touchEvent['originalEvent'] = { | |
targetTouches: [{ | |
identifier: 0, | |
pageX: 0, | |
pageY: 10 | |
}] | |
}; | |
element.trigger(touchEvent); | |
touchEvent = new jQuery.Event(); | |
touchEvent.type='touchend'; | |
touchEvent['originalEvent'] = { | |
changedTouches: [{ | |
identifier: 0, | |
pageX: 0, | |
pageY: 10 | |
}] | |
}; | |
element.trigger(touchEvent); | |
ok(tapEndWasCalled, 'tap end should have been called'); | |
view.destroy(); | |
application.destroy(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment