Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ralfschimmel/1391158 to your computer and use it in GitHub Desktop.
Save ralfschimmel/1391158 to your computer and use it in GitHub Desktop.
Failtest sproutcore childview in collectionview
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