Commit b082e9f6 authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review
Browse files

Merge "Bug 1511536: problem with deleting blocks when edit page first loads"

parents a58fedf0 52770f8b
......@@ -531,8 +531,13 @@
/**
* Rewrites one delete button to be AJAX
*
* @param button: The button to rewrite it for
* @param pblockinstanceId: If this is being called from the modal popup, we won't be able
* to retrieve the button's ID. So this optional parameter can supply the button ID directly
* in that case.
*/
function rewriteDeleteButton(button, blockinstanceId) {
function rewriteDeleteButton(button, pblockinstanceId) {
button.off('click');
button.on('click', function(e) {
......@@ -541,11 +546,17 @@
e.preventDefault();
var self = $(this),
pd = {'id': $('#viewid').val(), 'change': 1};
pd = {'id': $('#viewid').val(), 'change': 1},
blockinstanceId;
if ((blockinstanceId === undefined) && self.attr('data-id')) {
// If pblockinstanceId wasn't passed, retrieve the id from the button.
if ((pblockinstanceId === undefined) && self.attr('data-id')) {
blockinstanceId = self.attr('data-id');
}
// If pblockinstanceId was passed, then use that.
else {
blockinstanceId = pblockinstanceId;
}
self.prop('disabled', true);
......@@ -554,8 +565,7 @@
pd[self.attr('name')] = 1;
sendjsonrequest(config['wwwroot'] + 'view/blocks.json.php', pd, 'POST', function(data) {
if (blockinstanceId !== undefined) {
if (blockinstanceId !== undefined && blockinstanceId !== null) {
$('#blockinstance_' + blockinstanceId).remove();
}
......
......@@ -20,6 +20,24 @@ Scenario: Clicking ID's (Bug 1428456)
And I press "Save"
Then I should see "Buck Mulligan"
And I follow "Text"
And I press "Add"
And I wait "1" seconds
And I set the following fields to these values:
| Block title | The Sun Also Rises |
| Block content | <p>Robert Cohn was once middleweight boxing champion of Princeton. Do not think that I am very much impressed by that as a boxing title, but it meant a lot to Cohn...</p> |
And I press "Save"
Then I should see "Robert Cohn"
And I follow "Text"
And I press "Add"
And I wait "1" seconds
And I set the following fields to these values:
| Block title | 1984 |
| Block content | <p>It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind...</p> |
And I press "Save"
Then I should see "Winston Smith"
# Checking if we can edit a block
When I configure the block "About me"
And I set the following fields to these values:
......@@ -27,7 +45,14 @@ Scenario: Clicking ID's (Bug 1428456)
And I press "Save"
Then I should see "James Joyce"
# Checking if we can delete a block
# Checking that we can delete more than one block (Bug #1511536)
# We need to leave and return to the page for this
And I follow "Display page"
And I follow "Edit this page"
When I delete the block "The Sun Also Rises"
Then I should not see "Robert Cohn"
When I delete the block "1984"
Then I should not see "Winston Smith"
When I delete the block "Ulysses"
Then I should not see "Buck Mulligan"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment