@unique_id ||= (Time.now.to_f*1000000).to_i
span_id = object.uuid.to_s + '-' + attr.to_s + '-' + (@unique_id += 1).to_s
- span_tag = content_tag 'span', attrvalue.to_s, {
- "data-emptytext" => ('(none)'),
+ span_tag = content_tag 'span', rendervalue, {
- "data-emptytext" => (object.andand.default_name || 'none'),
++ "data-emptytext" => '(none)',
"data-placement" => "bottom",
"data-type" => input_type,
- "data-title" => "Edit #{attr.gsub '_', ' '}",
+ "data-title" => "Edit #{attr.to_s.gsub '_', ' '}",
"data-name" => attr,
"data-object-uuid" => object.uuid,
"data-toggle" => "manual",
"Description update did not survive page refresh")
end
+ test 'Find a project and edit description to textile description' do
+ visit page_with_token 'active', '/'
+ find('.arv-project-list a,button', text: 'A Project').
+ click
+ within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do
+ find('span', text: api_fixture('groups')['aproject']['name']).click
+ within('.arv-description-as-subtitle') do
+ find('.fa-pencil').click
+ find('.editable-input textarea').set('*Textile description for A project* - "take me home":/')
+ find('.editable-submit').click
+ end
+ wait_for_ajax
+ end
+ visit current_path
+ assert(find?('.container-fluid', text: 'Textile description for A project'),
+ "Description update did not survive page refresh")
+ assert(!find?('.container-fluid', text: '*Textile description for A project*'),
+ "Textile description is displayed with uninterpreted formatting characters")
+ assert(page.has_link?("take me home"), "link not found in description")
+ click_link 'take me home'
+ assert page.has_text?('My projects')
+ assert page.has_text?('Projects shared with me')
+ end
+
+ test 'Find a project and edit description to html description' do
+ visit page_with_token 'active', '/'
+ find('.arv-project-list a,button', text: 'A Project').
+ click
+ within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do
+ find('span', text: api_fixture('groups')['aproject']['name']).click
+ within('.arv-description-as-subtitle') do
+ find('.fa-pencil').click
+ find('.editable-input textarea').set('<br>Textile description for A project</br> - <a href="/">take me home</a>')
+ find('.editable-submit').click
+ end
+ wait_for_ajax
+ end
+ visit current_path
+ assert(find?('.container-fluid', text: 'Textile description for A project'),
+ "Description update did not survive page refresh")
+ assert(!find?('.container-fluid', text: '<br>Textile description for A project</br>'),
+ "Textile description is displayed with uninterpreted formatting characters")
+ assert(page.has_link?("take me home"),"link not found in description")
+ click_link 'take me home'
+ assert page.has_text?('My projects')
+ assert page.has_text?('Projects shared with me')
+ end
+
+ test 'Find a project and edit description to textile description with link to object' do
+ visit page_with_token 'active', '/'
+ find('.arv-project-list a,button', text: 'A Project').
+ click
+ within('.container-fluid', text: api_fixture('groups')['aproject']['name']) do
+ find('span', text: api_fixture('groups')['aproject']['name']).click
+ within('.arv-description-as-subtitle') do
+ find('.fa-pencil').click
+ find('.editable-input textarea').set('*Textile description for A project* - "go to sub-project":' + api_fixture('groups')['asubproject']['uuid'] + "'")
+ find('.editable-submit').click
+ end
+ wait_for_ajax
+ end
+ visit current_path
+ assert(find?('.container-fluid', text: 'Textile description for A project'),
+ "Description update did not survive page refresh")
+ assert(!find?('.container-fluid', text: '*Textile description for A project*'),
+ "Textile description is displayed with uninterpreted formatting characters")
+ assert(page.has_link?("go to sub-project"), "link not found in description")
+ click_link 'go to sub-project'
+ assert(page.has_text?(api_fixture('groups')['asubproject']['name']), 'sub-project name not found after clicking link')
+ end
+
test 'Add a new name, then edit it, without creating a duplicate' do
project_uuid = api_fixture('groups')['aproject']['uuid']
- specimen_uuid = api_fixture('specimens')['owned_by_aproject_with_no_name_link']['uuid']
+ specimen_uuid = api_fixture('traits')['owned_by_aproject_with_no_name']['uuid']
visit page_with_token 'active', '/projects/' + project_uuid
click_link 'Other objects'
within '.selection-action-container' do