diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 15f36ea49..cf70af993 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -30,12 +30,11 @@ var initialize_modules = function() { App.Votes.initialize(); App.Tags.initialize(); App.Stats.initialize(); + App.Dropdown.initialize(); App.LocationChanger.initialize(); }; $(function(){ - $(document).foundation(); - $(document).ready(initialize_modules); $(document).on('page:load', initialize_modules); $(document).on('ajax:complete', initialize_modules); diff --git a/app/assets/javascripts/dropdown.js.coffee b/app/assets/javascripts/dropdown.js.coffee new file mode 100644 index 000000000..0107bdf64 --- /dev/null +++ b/app/assets/javascripts/dropdown.js.coffee @@ -0,0 +1,4 @@ +App.Dropdown = + + initialize: -> + $(document).foundation(); \ No newline at end of file diff --git a/spec/features/comments_spec.rb b/spec/features/comments_spec.rb index e4832a263..2bdd380bd 100644 --- a/spec/features/comments_spec.rb +++ b/spec/features/comments_spec.rb @@ -169,6 +169,21 @@ feature 'Comments' do expect(Flag.flagged?(user, comment)).to_not be end + scenario "Flagging turbolinks sanity check", :js do + user = create(:user) + debate = create(:debate, title: "Should we change the world?") + comment = create(:comment, commentable: debate) + + login_as(user) + visit debates_path + click_link "Should we change the world?" + + within "#comment_#{comment.id}" do + page.find("#flag-expand-comment-#{comment.id}").click + expect(page).to have_selector("#flag-comment-#{comment.id}") + end + end + feature "Moderators" do scenario "can create comment as a moderator", :js do moderator = create(:moderator)