Merge pull request #365 from AyuntamientoMadrid/flags_for_turbolinks

Flags for turbolinks
This commit is contained in:
Juanjo Bazán
2015-09-05 10:02:18 +02:00
3 changed files with 20 additions and 2 deletions

View File

@@ -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);

View File

@@ -0,0 +1,4 @@
App.Dropdown =
initialize: ->
$(document).foundation();

View File

@@ -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)