$.namespace('Causes.Account.Privacy', (function() {
var internalVar1;
var internalVar2;
function init() { /* stuff */ }
function set_spider_visibility() { /* stuff */ }
function set_open_graph_visibility() { /* stuff */ }
function set_open_graph_perms_listener() { /* stuff */ }
return {
init: init
};
})());
$(Causes.Account.Privacy.init);
Causes.classify()
and
subclass()
as a convenient API for defining "classes"
Causes.Paginator = Causes.classify({
// defaults on the prototype
targetSelector : '#item-list',
buttonSelector : '#see-more',
// functions
// constructor, called automatically
init : function(opts) {
this.extendOptions(opts); // override defaults
},
clickHandler : function() { /* ... */ },
loadContent: function() { /* ... */ },
replaceContent: function() { /* ... */ }
});
Causes.FancyPaginator = Causes.Paginator.subclass({
replaceConent: function() { /* override */ }
});
<div id='#sidebar-item-list' />
<div id='#see-more' />
<script>
new Causes.Paginator({ targetSelector: '#sidebar-item-list' });
</script>
describe('Causes.Paginator', function() {
var paginator;
beforeEach(function() { /* set-up */ });
afterEach(function() { /* tear-down */ });
describe('loadContent', function() {
it('show the content div') {
paginator.loadContent();
expect($('#item-list').is(':visible')).toBeFalsey();
};
});
describe SomeController do
render_views
describe '#show' do
it 'saves a fixture', :jasmine => true do
get :show
response.should be_success # sanity check
save_fixture(response.body, 'snippet_filename')
save_fixture(html_for('#sidebar'), 'other_snippet')
end
end
end
rake jasmine # Run the Jasmine server
rake jasmine:fixtures:clear # Clears the Jasmine fixures
rake jasmine:fixtures:generate # Generates the Jasmine fixtures
rake jasmine:fixtures # Clears then generates the Jasmine fixtures
beforeEach(function() {
// loads the fragment into #jasmine_content
spec.loadFixture('snippet_filename');
});
#jasmine_content
div is automatically cleared after each example