diff --git a/tests/multiple_values_widget.test b/tests/multiple_values_widget.test index c9456bf..641bf5c 100644 --- a/tests/multiple_values_widget.test +++ b/tests/multiple_values_widget.test @@ -336,16 +336,18 @@ class MultipleValuesWidgetTest extends InlineEntityFormTestBase { $this->assertTrue($node->field_first_name[LANGUAGE_NONE][0]['value'] == 'John', 'First name in reference node changed to John'); $this->assertTrue($node->field_last_name[LANGUAGE_NONE][0]['value'] == 'Doe', 'Last name in reference node changed to Doe'); - // Delete the second entity. + // Delete the last entity. $this->drupalGet('node/' . $parent_node->nid . '/edit'); - $cell = $this->xpath('//table[@id="ief-entity-table-edit-field-multiple-nodes-und-entities"]/tbody/tr[@class="ief-row-entity draggable even"]/td[@class="inline-entity-form-node-title"]'); + $cell = $this->xpath('//table[@id="ief-entity-table-edit-field-multiple-nodes-und-entities"]/tbody//tr[3]//td[@class="inline-entity-form-node-title"]'); $title = (string) $cell[0]; - $this->drupalPostAjax(NULL, array(), $this->getButtonName('//input[@type="submit" and @id="edit-field-multiple-nodes-und-entities-1-actions-ief-entity-remove"]')); + $this->drupalPost(NULL, array(), 'Remove'); $this->assertResponse(200, 'Opening inline remove confirm form was successful.'); $this->assertText('Are you sure you want to remove', 'Remove warning message is displayed.'); - $this->drupalPostAjax(NULL, array('field_multiple_nodes[und][entities][1][form][delete]' => '1'), $this->getButtonName('//input[@type="submit" and @id="edit-field-multiple-nodes-und-entities-1-form-actions-ief-remove-confirm"]')); + $edit = array('field_multiple_nodes[und][entities][2][form][delete]' => '1'); + $this->drupalPost(NULL, $edit, 'Remove'); + $this->assertResponse(200, 'Removing inline entity was successful.'); $this->assertNoText($title, 'Deleted inline entity is not present on the page.'); @@ -360,17 +362,17 @@ class MultipleValuesWidgetTest extends InlineEntityFormTestBase { $this->drupalGet('node/' . $parent_node->nid . '/edit'); $this->assertNoText($title, 'Deleted inline entity is not present on the page after saving parent.'); - // Delete the third entity reference only, don't delete the node. The third - // entity now is second referenced entity because the second one was deleted + // Delete the last entity reference only, don't delete the node. The last + // entity now is second referenced entity because we already deleted one // in previous step. $this->drupalGet('node/' . $parent_node->nid . '/edit'); - $cell = $this->xpath('//table[@id="ief-entity-table-edit-field-multiple-nodes-und-entities"]/tbody/tr[@class="ief-row-entity draggable even"]/td[@class="inline-entity-form-node-title"]'); + $cell = $this->xpath('//table[@id="ief-entity-table-edit-field-multiple-nodes-und-entities"]/tbody//tr[2]//td[@class="inline-entity-form-node-title"]'); $title = (string) $cell[0]; - $this->drupalPostAjax(NULL, array(), $this->getButtonName('//input[@type="submit" and @id="edit-field-multiple-nodes-und-entities-1-actions-ief-entity-remove"]')); + $this->drupalPost(NULL, array(), 'Remove'); $this->assertResponse(200, 'Opening inline remove confirm form was successful.'); - $this->drupalPostAjax(NULL, array(), $this->getButtonName('//input[@type="submit" and @id="edit-field-multiple-nodes-und-entities-1-form-actions-ief-remove-confirm"]')); + $this->drupalPost(NULL, array(), 'Remove'); $this->assertResponse(200, 'Removing inline entity was successful.'); // Save the ief_test_multiple node.