Commit 98d516d9 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Make the form change checker reset correctly with block config modal"

parents d265e8e3 86f56e0c
......@@ -30,7 +30,16 @@ function FormChangeManager() {
}
this.add = function(formid) {
self.formcheckers.push(new FormChangeChecker(formid));
var alreadyfound = self.find(formid);
if (alreadyfound === null) {
newform = new FormChangeChecker(formid);
self.formcheckers.push(newform);
}
else {
alreadyfound.unbind();
alreadyfound.reset();
alreadyfound.bind();
}
}
this.checkDirtyChanges = function() {
......
......@@ -1151,6 +1151,13 @@
function hideDock() {
// Reset the form change checker
var form = formchangemanager.find('instconf');
if (form !== null) {
form.unbind();
form.reset();
}
dock.hide();
}
......
......@@ -999,6 +999,28 @@ class BehatGeneral extends BehatBase {
}
/**
* Close the config modal dialog.
*
* @When /^I close the config dialog$/
* @throws ElementNotFoundException
*/
public function i_close_config_dialog() {
// Find the config dialog close button.
$exception = new ElementNotFoundException($this->getSession(), 'dialog');
$xpath = "//div[@id='configureblock']" .
"//div[contains(concat(' ', normalize-space(@class), ' '), ' modal-dialog ')]" .
"//button[contains(concat(' ', normalize-space(@class), ' '), ' close ')]";
$closebutton = $this->find('xpath', $xpath, $exception);
if ($closebutton->isVisible()) {
$closebutton->click();
$this->getSession()->getDriver()->getWebDriverSession()->accept_alert();
return;
}
}
/**
* Tick the radio button
* https://github.com/Kunstmaan/KunstmaanBehatBundle/blob/master/Features/Context/SubContext/RadioButtonSubContext.php
......
......@@ -56,6 +56,17 @@ Scenario: Clicking ID's (Bug 1428456)
When I delete the block "Ulysses"
Then I should not see "Buck Mulligan"
# Checking we can add a block, make config changes, then delete the block
# without it causing 'unsaved changes' popup when navigating away
And I follow "Text"
And I press "Add"
And I wait "1" seconds
And I set the following fields to these values:
| Block title | Crime and punishment |
| Block content | <p>On an exceptionally hot evening early in July a young man came out of the garret in which he lodged in S. Place and walked slowly, as though in hesitation, towards K. bridge...</p> |
And I close the config dialog
And I scroll to the id "main-nav"
# Checking if we can change page layout
When I follow "Edit layout"
And I follow "Create custom layout"
......
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