|
135 | 135 |
|
136 | 136 | expect(subrecords.length).to eq @digital_object_number_of_file_versions - 1
|
137 | 137 | end
|
| 138 | + |
| 139 | +Then 'the Digital Object Component with Label {string} is saved as a child of the Digital Object' do |text| |
| 140 | + records = all('#tree-container .table-row', text:) |
| 141 | + |
| 142 | + expect(records.length).to eq 1 |
| 143 | + expect(records[0][:class]).to include 'indent-level-1 current' |
| 144 | + |
| 145 | + expect(page).to have_css "#tree-container #digital_object_#{@digital_object_id} + .table-row-group #digital_object_component_#{@created_record_id}" |
| 146 | +end |
| 147 | + |
| 148 | +Then 'the Digital Object Component with Title {string} is saved as a sibling of the selected Digital Object Component' do |title| |
| 149 | + records = all('#tree-container .table-row', text: title) |
| 150 | + |
| 151 | + expect(records.length).to eq 1 |
| 152 | + expect(records[0][:class]).to include 'indent-level-1 current' |
| 153 | + expect(page).to have_css "#tree-container #digital_object_#{@digital_object_id} + .table-row-group #digital_object_component_#{@created_record_id}" |
| 154 | +end |
| 155 | + |
| 156 | +Given 'a Digital Object with a Digital Object Component has been created' do |
| 157 | + visit "#{STAFF_URL}/digital_objects/new" |
| 158 | + |
| 159 | + fill_in 'digital_object_digital_object_id_', with: "Digital Object Identifier #{@uuid}" |
| 160 | + fill_in 'digital_object_title_', with: "Digital Object Title #{@uuid}" |
| 161 | + |
| 162 | + click_on 'Add Date' |
| 163 | + select 'Single', from: 'digital_object_dates__0__date_type_' |
| 164 | + fill_in 'digital_object_dates__0__begin_', with: '2000-01-01' |
| 165 | + |
| 166 | + click_on 'Save' |
| 167 | + |
| 168 | + wait_for_ajax |
| 169 | + expect(find('.alert.alert-success.with-hide-alert').text).to have_text "Digital Object Digital Object Title #{@uuid} Created" |
| 170 | + @digital_object_id = current_url.split('::digital_object_').pop |
| 171 | + |
| 172 | + click_on 'Add Child' |
| 173 | + wait_for_ajax |
| 174 | + |
| 175 | + fill_in 'Label', with: "Digital Object Component Label #{@uuid}" |
| 176 | + click_on 'Save' |
| 177 | + wait_for_ajax |
| 178 | + |
| 179 | + expect(find('.alert.alert-success.with-hide-alert').text).to eq "Digital Object Component created on Digital Object Digital Object Title #{@uuid}" |
| 180 | +end |
| 181 | + |
| 182 | +And 'the user selects the Digital Object Component' do |
| 183 | + click_on "Digital Object Component Label #{@uuid}" |
| 184 | +end |
0 commit comments