Commit 142fbb63bc58e9632687e93380ffbcda6f86f6b9

Authored by AntonioTerceiro
1 parent 72e1de65

ActionItem152: is this request a lightbox?


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1230 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/lightbox_helper.rb
... ... @@ -25,4 +25,8 @@ module LightboxHelper
25 25 options.merge(:class => the_class)
26 26 end
27 27  
  28 + def lightbox?
  29 + request.xhr?
  30 + end
  31 +
28 32 end
... ...
test/unit/lightbox_helper_text.rb
... ... @@ -44,4 +44,12 @@ class LightboxHelperTest < Test::Unit::TestCase
44 44 assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'})
45 45 end
46 46  
  47 + should 'tell if rendering inside lightbox' do
  48 + request = mock
  49 + expects(:request).returns(request)
  50 + request.espects(:xhr?).returns(true)
  51 +
  52 + assert lightbox?
  53 + end
  54 +
47 55 end
... ...