MDL-51311 javascript: Teach Behat to wait for pending JQuery ajax

This commit is contained in:
Damyon Wiese 2015-09-03 15:01:05 +08:00
parent e36d7d57ae
commit 1748938e15
3 changed files with 11 additions and 4 deletions

View File

@ -1 +1 @@
define(function(){});
define(["jquery"],function(a){a(document).bind("ajaxStart",function(){M.util.js_pending("jq")}).bind("ajaxStop",function(){M.util.js_complete("jq")})});

View File

@ -18,10 +18,19 @@
* Because every module is returned from a request for any other module, this
* forces the loading of all modules with a single request.
*
* This function also sets up the listeners for ajax requests so we can tell
* if any requests are still in progress.
*
* @module core/first
* @package core
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 2.9
*/
define(function() { });
define(['jquery'], function($) {
$(document).bind("ajaxStart", function(){
M.util.js_pending('jq');
}).bind("ajaxStop", function(){
M.util.js_complete('jq');
});
});

View File

@ -140,8 +140,6 @@ Feature: Users can edit tags to add description or rename
And I click on "Edit tag name" "link" in the "Cat" "table_row"
And I set the field "New name for tag Cat" to "Kitten"
And I press key "13" in the field "New name for tag Cat"
# TODO MDL-51311 : replace with "And I wait until the page is ready".
And I wait "2" seconds
Then I should not see "Cat"
And "New name for tag" "field" should not be visible
And I wait until "Kitten" "link" exists