diff --git a/test/test_view/drugs/centeredsearchform.rb b/test/test_view/drugs/centeredsearchform.rb index ae194cee8..c0423edb8 100644 --- a/test/test_view/drugs/centeredsearchform.rb +++ b/test/test_view/drugs/centeredsearchform.rb @@ -11,6 +11,7 @@ require 'view/drugs/centeredsearchform' require 'model/package' require 'view/resulttemplate' +require 'custom/lookandfeelwrapper.rb' require 'htmlgrid/labeltext' require 'view/migel/product' require 'remote/migel/model_super' @@ -122,7 +123,7 @@ def test_init__data_counts :limitation_text_count => 'limitation_text_count', :recent_registration_count => 'recent_registration_count' ) - expected = {[0, 9]=>"legal-note center", [0, 7]=>"legal-note", [0, 13]=>"legal-note"} + expected = {[0, 9]=>"legal-note center", [0, 7]=>"legal-note", [0, 15]=>"legal-note"} assert_equal(expected, @composite.init) end def test_init__facebook_fan @@ -154,7 +155,7 @@ def test_init__facebook_fan :limitation_text_count => 'limitation_text_count', :recent_registration_count => 'recent_registration_count' ) - expected = {[0, 9]=>"legal-note center", [0, 7]=>"legal-note", [0, 13]=>"legal-note"} + expected = {[0, 9]=>"legal-note center", [0, 7]=>"legal-note", [0, 16]=>"legal-note"} assert_equal(expected, @composite.init) end def test_create_link diff --git a/test/test_view/drugs/compare_search.rb b/test/test_view/drugs/compare_search.rb index 0bc519d34..c729158c6 100644 --- a/test/test_view/drugs/compare_search.rb +++ b/test/test_view/drugs/compare_search.rb @@ -62,7 +62,7 @@ def test_init function selectSubmit() { var popup = dojo.byId('searchbar_popup'); var searchbar = dojo.byId('searchbar'); - if (!popup.style.overflowX.match(/auto/) && searchbar.value != '') { + if (popup && popup.style.overflowX.match(/auto/) && searchbar.value != '') { setTimeout('show_progressbar(\\'widget_searchbar\\')', 10); searchbar.form.submit(); } diff --git a/test/test_view/searchbar.rb b/test/test_view/searchbar.rb index aa6899e12..ddfe10450 100644 --- a/test/test_view/searchbar.rb +++ b/test/test_view/searchbar.rb @@ -33,14 +33,17 @@ def setup @inputtext = ODDB::View::SearchBar.new('name', @model, @session, @container) end def test_init - expected = <<-SCRIPT + expected = %( function get_to(url) { + var url2 = url.replace(/(\\d{13})[/,]+(\\d{13})/, '$1,$2').replace('/,','/').replace(/\\?$/,'').replace('\\?,', ','); + if (window.location.href == url2) { return; } var form = document.createElement("form"); form.setAttribute("method", "GET"); - form.setAttribute("action", url); + form.setAttribute("action", url2); document.body.appendChild(form); form.submit(); } + if (name.value!='lookup') { var href = '_event_url' + encodeURIComponent(name.value.replace(/\\//, '%2F')); @@ -50,7 +53,7 @@ def test_init get_to(href); }; return false; - SCRIPT +) assert_equal(expected, @inputtext.init) end end @@ -103,9 +106,11 @@ def test_to_html class TestPrescriptionSearchBar []) @container = flexmock('container', :additional_javascripts => []) @lnf = flexmock('lookandfeel', :lookup => 'lookup', + :base_url => 'base_url', :attributes => {}, :event_url => 'event_url', :_event_url => '_event_url', @@ -113,7 +118,8 @@ def setup @session = flexmock('session', :flavor => 'gcc', :lookandfeel => @lnf, - :persistent_user_input => 'persistent_user_input', + :request_path => 'request_path', + :persistent_user_input => {'key' => 'value'}, :event => '' ) @model = flexmock('model')