Skip to content
Browse files

Fix sign out cancelation

  • Loading branch information...
1 parent ea000f4 commit 342c9d9436836525558e0f01f957124832190650 @reyesyang committed Dec 30, 2013
Showing with 15 additions and 1 deletion.
  1. +1 −0 app/assets/javascripts/persona.js.coffee
  2. +1 −1 app/views/layouts/_aside.html.haml
  3. +13 −0 spec/features/persona_spec.rb
View
1 app/assets/javascripts/persona.js.coffee
@@ -31,4 +31,5 @@ $ () ->
$logout_button.on 'click', (e) ->
e.preventDefault()
+ return unless confirm("确定吗?")
navigator.id.logout()
View
2 app/views/layouts/_aside.html.haml
@@ -5,7 +5,7 @@
= link_to '吾', '/about'
#passage
- if logged_in?
- = link_to '#', id: 'logout-button', class: 'persona-button dark', data: { confirm: '确定吗?' } do
+ = link_to '#', id: 'logout-button', class: 'persona-button dark' do
%span 退出
- else
= link_to '#', id: 'login-button', class: 'persona-button dark' do
View
13 spec/features/persona_spec.rb
@@ -9,4 +9,17 @@
sign_out
expect(page).to have_content "登录"
end
+
+ scenario "cancel sign out", js: true, focus: true do
+ visit root_path
+ sign_in APP_CONFIG["admin_email"]
+
+ click_link "退出"
+ alert = page.driver.browser.switch_to.alert
+ alert.dismiss
+
+ expect(page).to have_content "退出"
+
+ sign_out
+ end
end

0 comments on commit 342c9d9

Please sign in to comment.
Something went wrong with that request. Please try again.