Merge branch 'MDL-66550-35-2' of git://github.com/andrewnicols/moodle into MOODLE_35_STABLE
This commit is contained in:
@@ -48,7 +48,6 @@ class behat_admin extends behat_base {
|
||||
* @param TableNode $table
|
||||
*/
|
||||
public function i_set_the_following_administration_settings_values(TableNode $table) {
|
||||
|
||||
if (!$data = $table->getRowsHash()) {
|
||||
return;
|
||||
}
|
||||
@@ -57,17 +56,12 @@ class behat_admin extends behat_base {
|
||||
|
||||
// We expect admin block to be visible, otherwise go to homepage.
|
||||
if (!$this->getSession()->getPage()->find('css', '.block_settings')) {
|
||||
$this->getSession()->visit($this->locate_path('/'));
|
||||
$this->wait(self::get_timeout() * 1000, self::PAGE_READY_JS);
|
||||
$this->execute('behat_forms::i_am_on_homepage');
|
||||
}
|
||||
|
||||
// Search by label.
|
||||
$searchbox = $this->find_field(get_string('searchinsettings', 'admin'));
|
||||
$searchbox->setValue($label);
|
||||
$submitsearch = $this->find('css', 'form.adminsearchform input[type=submit]');
|
||||
$submitsearch->press();
|
||||
|
||||
$this->wait(self::get_timeout() * 1000, self::PAGE_READY_JS);
|
||||
$this->execute('behat_forms::i_set_the_field_to', [get_string('searchinsettings', 'admin'), $label]);
|
||||
$this->execute("behat_general::i_click_on_in_the", [get_string('search', 'admin'), 'button', '.block_settings', 'css_element']);
|
||||
|
||||
// Admin settings does not use the same DOM structure than other moodle forms
|
||||
// but we also need to use lib/behat/form_field/* to deal with the different moodle form elements.
|
||||
@@ -83,35 +77,17 @@ class behat_admin extends behat_base {
|
||||
"@id=//span[contains(normalize-space(.), $label)]/preceding-sibling::label[1]/@for]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath, $exception);
|
||||
|
||||
$formfieldtypenode = $this->find('xpath', $fieldxpath . "/ancestor::div[@class='form-setting']" .
|
||||
"/child::div[contains(concat(' ', @class, ' '), ' form-')]/child::*/parent::div");
|
||||
|
||||
} catch (ElementNotFoundException $e) {
|
||||
|
||||
// Multi element settings, interacting only the first one.
|
||||
$fieldxpath = "//*[label[normalize-space(.)= $label]|span[normalize-space(.)= $label]]/" .
|
||||
"ancestor::div[contains(concat(' ', normalize-space(@class), ' '), ' form-item ')]" .
|
||||
"/descendant::div[@class='form-group']/descendant::*[self::input | self::textarea | self::select]" .
|
||||
"[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath);
|
||||
|
||||
// It is the same one that contains the type.
|
||||
$formfieldtypenode = $fieldnode;
|
||||
}
|
||||
|
||||
// Getting the class which contains the field type.
|
||||
$classes = explode(' ', $formfieldtypenode->getAttribute('class'));
|
||||
foreach ($classes as $class) {
|
||||
if (substr($class, 0, 5) == 'form-') {
|
||||
$type = substr($class, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// Instantiating the appropiate field type.
|
||||
$field = behat_field_manager::get_field_instance($type, $fieldnode, $this->getSession());
|
||||
$field->set_value($value);
|
||||
|
||||
$this->find_button(get_string('savechanges'))->press();
|
||||
$this->execute('behat_forms::i_set_the_field_with_xpath_to', [$fieldxpath, $value]);
|
||||
$this->execute("behat_general::i_click_on", [get_string('savechanges'), 'button']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,10 @@ class fragment_requirements_manager extends page_requirements_manager {
|
||||
$output = '';
|
||||
|
||||
// First include must be to a module with no dependencies, this prevents multiple requests.
|
||||
$prefix = "require(['core/first'], function() {\n";
|
||||
$prefix = 'M.util.js_pending("core/first");';
|
||||
$prefix .= "require(['core/first'], function() {\n";
|
||||
$suffix = "\n});";
|
||||
$suffix .= 'M.util.js_complete("core/first");';
|
||||
$output .= html_writer::script($prefix . implode(";\n", $this->amdjscode) . $suffix);
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -1015,6 +1015,8 @@ class page_requirements_manager {
|
||||
$module = clean_param($module, PARAM_ALPHANUMEXT);
|
||||
$func = clean_param($func, PARAM_ALPHANUMEXT);
|
||||
|
||||
$modname = "{$component}/{$module}";
|
||||
|
||||
$jsonparams = array();
|
||||
foreach ($params as $param) {
|
||||
$jsonparams[] = json_encode($param);
|
||||
@@ -1027,9 +1029,15 @@ class page_requirements_manager {
|
||||
'"). Generally there are better ways to pass lots of data from PHP to JavaScript, for example via Ajax, data attributes, ... . ' .
|
||||
'This warning is triggered if the argument string becomes longer than ' . $toomanyparamslimit . ' characters.', DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
|
||||
$js = 'require(["' . $component . '/' . $module . '"], function(amd) { amd.' . $func . '(' . $strparams . '); });';
|
||||
}
|
||||
$js = <<<EOF
|
||||
M.util.js_pending('{$modname}');
|
||||
require(['{$modname}'], function(amd) {
|
||||
amd.{$func}({$strparams});
|
||||
M.util.js_complete('{$modname}');
|
||||
});
|
||||
EOF;
|
||||
|
||||
$this->js_amd_inline($js);
|
||||
}
|
||||
@@ -1343,8 +1351,10 @@ class page_requirements_manager {
|
||||
}
|
||||
|
||||
// First include must be to a module with no dependencies, this prevents multiple requests.
|
||||
$prefix = "require(['core/first'], function() {\n";
|
||||
$suffix = "\n});";
|
||||
$prefix = 'M.util.js_pending("core/first");';
|
||||
$prefix .= "require(['core/first'], function() {\n";
|
||||
$suffix = 'M.util.js_complete("core/first");';
|
||||
$suffix .= "\n});";
|
||||
$output .= html_writer::script($prefix . implode(";\n", $this->amdjscode) . $suffix);
|
||||
return $output;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","./tether","core/event"],function(a,b,c){return window.jQuery=a,window.Tether=b,require(["theme_boost/aria","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"}),a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}}),c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:'[data-toggle="popover"]',trigger:"focus"})})}),b.init()}),{}});
|
||||
define(["jquery","./tether","core/event"],function(a,b,c){return window.jQuery=a,window.Tether=b,M.util.js_pending("theme_boost/loader:children"),require(["theme_boost/aria","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"}),a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}}),c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:'[data-toggle="popover"]',trigger:"focus"})})}),b.init(),M.util.js_complete("theme_boost/loader:children")}),{}});
|
||||
@@ -27,6 +27,7 @@ define(['jquery', './tether', 'core/event'], function(jQuery, Tether, Event) {
|
||||
|
||||
window.jQuery = jQuery;
|
||||
window.Tether = Tether;
|
||||
M.util.js_pending('theme_boost/loader:children');
|
||||
|
||||
require(['theme_boost/aria',
|
||||
'theme_boost/util',
|
||||
@@ -69,6 +70,7 @@ define(['jquery', './tether', 'core/event'], function(jQuery, Tether, Event) {
|
||||
});
|
||||
|
||||
Aria.init();
|
||||
M.util.js_complete('theme_boost/loader:children');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -65,5 +65,8 @@
|
||||
</body>
|
||||
</html>
|
||||
{{#js}}
|
||||
require(['theme_boost/loader']);
|
||||
M.util.js_pending('theme_boost/loader');
|
||||
require(['theme_boost/loader'], function() {
|
||||
M.util.js_complete('theme_boost/loader');
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -97,8 +97,13 @@
|
||||
</body>
|
||||
</html>
|
||||
{{#js}}
|
||||
require(['theme_boost/loader']);
|
||||
M.util.js_pending('theme_boost/loader');
|
||||
require(['theme_boost/loader'], function() {
|
||||
M.util.js_complete('theme_boost/loader');
|
||||
});
|
||||
M.util.js_pending('theme_boost/drawer');
|
||||
require(['theme_boost/drawer'], function(mod) {
|
||||
mod.init();
|
||||
M.util.js_complete('theme_boost/drawer');
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -53,5 +53,8 @@
|
||||
</body>
|
||||
</html>
|
||||
{{#js}}
|
||||
require(['theme_boost/loader']);
|
||||
M.util.js_pending('theme_boost/loader');
|
||||
require(['theme_boost/loader'], function() {
|
||||
M.util.js_complete('theme_boost/loader');
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -67,5 +67,8 @@
|
||||
</body>
|
||||
</html>
|
||||
{{#js}}
|
||||
require(['theme_boost/loader']);
|
||||
M.util.js_pending('theme_boost/loader');
|
||||
require(['theme_boost/loader'], function() {
|
||||
M.util.js_complete('theme_boost/loader');
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -74,5 +74,8 @@
|
||||
</body>
|
||||
</html>
|
||||
{{#js}}
|
||||
require(['theme_boost/loader']);
|
||||
M.util.js_pending('theme_boost/loader');
|
||||
require(['theme_boost/loader'], function() {
|
||||
M.util.js_complete('theme_boost/loader');
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -86,5 +86,8 @@
|
||||
</body>
|
||||
</html>
|
||||
{{#js}}
|
||||
require(['theme_boost/loader']);
|
||||
M.util.js_pending('theme_boost/loader');
|
||||
require(['theme_boost/loader'], function() {
|
||||
M.util.js_complete('theme_boost/loader');
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
@@ -48,12 +48,8 @@ class behat_theme_boost_behat_admin extends behat_admin {
|
||||
$this->execute('behat_navigation::i_select_from_flat_navigation_drawer', [get_string('administrationsite')]);
|
||||
|
||||
// Search by label.
|
||||
$searchbox = $this->find_field(get_string('query', 'admin'));
|
||||
$searchbox->setValue($label);
|
||||
$submitsearch = $this->find('css', 'form input[type=submit][name=search]');
|
||||
$submitsearch->press();
|
||||
|
||||
$this->wait(self::get_timeout() * 1000, self::PAGE_READY_JS);
|
||||
$this->execute('behat_forms::i_set_the_field_to', [get_string('query', 'admin'), $label]);
|
||||
$this->execute("behat_general::i_click_on", [get_string('search', 'admin'), 'button']);
|
||||
|
||||
// Admin settings does not use the same DOM structure than other moodle forms
|
||||
// but we also need to use lib/behat/form_field/* to deal with the different moodle form elements.
|
||||
@@ -69,11 +65,6 @@ class behat_theme_boost_behat_admin extends behat_admin {
|
||||
"[@id=//label[contains(normalize-space(.), $label)]/@for or " .
|
||||
"@id=//span[contains(normalize-space(.), $label)]/preceding-sibling::label[1]/@for]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath, $exception);
|
||||
|
||||
$formfieldtypenode = $this->find('xpath', $fieldxpath .
|
||||
"/ancestor::div[contains(concat(' ', @class, ' '), ' form-setting ')]" .
|
||||
"/child::div[contains(concat(' ', @class, ' '), ' form-')]/child::*/parent::div");
|
||||
|
||||
} catch (ElementNotFoundException $e) {
|
||||
|
||||
// Multi element settings, interacting only the first one.
|
||||
@@ -83,25 +74,11 @@ class behat_theme_boost_behat_admin extends behat_admin {
|
||||
"/descendant::*[self::input | self::textarea | self::select]" .
|
||||
"[not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]";
|
||||
$fieldnode = $this->find('xpath', $fieldxpath);
|
||||
|
||||
// It is the same one that contains the type.
|
||||
$formfieldtypenode = $fieldnode;
|
||||
}
|
||||
|
||||
// Getting the class which contains the field type.
|
||||
$classes = explode(' ', $formfieldtypenode->getAttribute('class'));
|
||||
$type = false;
|
||||
foreach ($classes as $class) {
|
||||
if (substr($class, 0, 5) == 'form-') {
|
||||
$type = substr($class, 5);
|
||||
}
|
||||
}
|
||||
$this->execute('behat_forms::i_set_the_field_with_xpath_to', [$fieldxpath, $value]);
|
||||
|
||||
// Instantiating the appropiate field type.
|
||||
$field = behat_field_manager::get_field_instance($type, $fieldnode, $this->getSession());
|
||||
$field->set_value($value);
|
||||
|
||||
$this->find_button(get_string('savechanges'))->press();
|
||||
$this->execute("behat_general::i_click_on", [get_string('savechanges'), 'button']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user