MDL-47494 ddmarker: Update dd qtype tests to use js_pending not fixed waits #14895
authorTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 13 Feb 2015 18:58:40 +0000 (18:58 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 13 Feb 2015 18:59:57 +0000 (18:59 +0000)
question/type/ddmarker/tests/behat/preview.feature
question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd-debug.js
question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd-min.js
question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd.js
question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form-debug.js
question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form-min.js
question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form.js
question/type/ddmarker/yui/src/ddmarker/js/ddmarker.js
question/type/ddmarker/yui/src/form/js/form.js

index 5d949b8..a4f345a 100644 (file)
@@ -28,7 +28,6 @@ Feature: Preview a drag-drop onto image question
   Scenario: Preview a question using the mouse.
     When I click on "Preview" "link" in the "Drag markers" "table_row"
     And I switch to "questionpreview" window
-    And I wait "2" seconds
     # Odd, but the <br>s go to nothing, not a space.
     And I drag "OU" to "340,228" in the drag and drop markers question
     And I drag "Railway station" to "252,195" in the drag and drop markers question
@@ -42,7 +41,6 @@ Feature: Preview a drag-drop onto image question
   Scenario: Preview a question using the keyboard.
     When I click on "Preview" "link" in the "Drag markers" "table_row"
     And I switch to "questionpreview" window
-    And I wait "1" seconds
     And I type "up" "89" times on marker "Railway station" in the drag and drop markers question
     And I type "right" "21" times on marker "Railway station" in the drag and drop markers question
     And I press "Submit and finish"
index 204c67f..2487de2 100644 (file)
Binary files a/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd-debug.js and b/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd-debug.js differ
index 40ef3f5..c719e3c 100644 (file)
Binary files a/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd-min.js and b/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd-min.js differ
index 204c67f..2487de2 100644 (file)
Binary files a/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd.js and b/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-dd/moodle-qtype_ddmarker-dd.js differ
index cccbc22..1fb1315 100644 (file)
Binary files a/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form-debug.js and b/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form-debug.js differ
index 0c20abf..db5248e 100644 (file)
Binary files a/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form-min.js and b/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form-min.js differ
index cccbc22..1fb1315 100644 (file)
Binary files a/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form.js and b/question/type/ddmarker/yui/build/moodle-qtype_ddmarker-form/moodle-qtype_ddmarker-form.js differ
index bb89b62..65f81c8 100644 (file)
@@ -306,7 +306,10 @@ var DDMARKER_QUESTION = function() {
  * This is the code for question rendering.
  */
 Y.extend(DDMARKER_QUESTION, M.qtype_ddmarker.dd_base_class, {
+    pendingid: '',
     initializer : function() {
+        this.pendingid = 'qtype_ddmarker-' + Math.random().toString(36).slice(2); // Random string.
+        M.util.js_pending(this.pendingid);
         this.doc = this.doc_structure(this);
         this.poll_for_image_load(null, false, 0, this.after_image_load);
         this.doc.bg_img().after('load', this.poll_for_image_load, this,
@@ -314,6 +317,7 @@ Y.extend(DDMARKER_QUESTION, M.qtype_ddmarker.dd_base_class, {
     },
     after_image_load : function () {
         this.redraw_drags_and_drops();
+        M.util.js_complete(this.pendingid);
         Y.later(2000, this, this.redraw_drags_and_drops, [], true);
     },
     clone_new_drag_item : function (draghome, itemno) {
index e8ac876..02a73fe 100644 (file)
@@ -24,6 +24,8 @@ Y.extend(DDMARKER_FORM, M.qtype_ddmarker.dd_base_class, {
     fp : null,
 
     initializer : function() {
+        var pendingid = 'qtype_ddmarker-form-' + Math.random().toString(36).slice(2); // Random string.
+        M.util.js_pending(pendingid);
         this.fp = this.file_pickers();
         var tn = Y.one(this.get('topnode'));
         tn.one('div.fcontainer').append(
@@ -37,7 +39,7 @@ Y.extend(DDMARKER_FORM, M.qtype_ddmarker.dd_base_class, {
         this.stop_selector_events();
         this.set_options_for_drag_item_selectors();
         this.setup_form_events();
-        Y.later(500, this, this.update_drop_zones, [], true);
+        Y.later(500, this, this.update_drop_zones, [pendingid], true);
         Y.after(this.load_bg_image, M.form_filepicker, 'callback', this);
         this.load_bg_image();
     },
@@ -96,6 +98,7 @@ Y.extend(DDMARKER_FORM, M.qtype_ddmarker.dd_base_class, {
             .setXY(this.doc.bg_img().getXY())
             .setStyle('width', this.doc.bg_img().get('width'))
             .setStyle('height', this.doc.bg_img().get('height'));
+        M.util.js_complete(this.pendingid);
     },
 
     get_coords : function (dropzoneno) {