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

index 7fde499..5fd5954 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 onto image" "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 "mountainbelt" to place "1" in the drag and drop onto image question
     And I drag "continentalshelf" to place "2" in the drag and drop onto image question
@@ -46,7 +45,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 onto image" "table_row"
     And I switch to "questionpreview" window
-    And I wait "1" seconds
     And I type "       " on place "1" in the drag and drop onto image question
     And I type "       " on place "2" in the drag and drop onto image question
     And I type "     " on place "3" in the drag and drop onto image question
index 10bacdd..6041757 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-debug.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-debug.js differ
index a7f8f78..92f8b43 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-min.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd-min.js differ
index 10bacdd..6041757 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd.js differ
index ec97e7b..e872225 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-form/moodle-qtype_ddimageortext-form-debug.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-form/moodle-qtype_ddimageortext-form-debug.js differ
index eba956a..c5fdf05 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-form/moodle-qtype_ddimageortext-form-min.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-form/moodle-qtype_ddimageortext-form-min.js differ
index ec97e7b..e872225 100644 (file)
Binary files a/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-form/moodle-qtype_ddimageortext-form.js and b/question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-form/moodle-qtype_ddimageortext-form.js differ
index d22e07c..f5b312c 100644 (file)
@@ -248,14 +248,17 @@ var DDIMAGEORTEXT_QUESTION = function() {
  * This is the code for question rendering.
  */
 Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
+    pendingid: '',
     initializer : function() {
+        this.pendingid = 'qtype_ddimageortext-' + 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.create_all_drag_and_drops);
         this.doc.bg_img().after('load', this.poll_for_image_load, this,
                                                 false, 0, this.create_all_drag_and_drops);
         this.doc.drag_item_homes().after('load', this.poll_for_image_load, this,
                                                 false, 0, this.create_all_drag_and_drops);
-        Y.later(500, this, this.reposition_drags_for_question, [], true);
+        Y.later(500, this, this.reposition_drags_for_question, [pendingid], true);
     },
     create_all_drag_and_drops : function () {
         this.init_drops();
@@ -291,6 +294,7 @@ Y.extend(DDIMAGEORTEXT_QUESTION, M.qtype_ddimageortext.dd_base_class, {
                     v.on('dragchange', this.drop_zone_key_press, this);
                 }, this);
         }
+        M.util.js_complete(this.pendingid);
     },
     drop_zone_key_press : function (e) {
         switch (e.direction) {
index bbd9413..a786dca 100644 (file)
@@ -22,9 +22,12 @@ var DDIMAGEORTEXT_FORM = function() {
 };
 
 Y.extend(DDIMAGEORTEXT_FORM, M.qtype_ddimageortext.dd_base_class, {
+    pendingid: '',
     fp : null,
 
     initializer : function() {
+        this.pendingid = 'qtype_ddimageortext-form-' + Math.random().toString(36).slice(2); // Random string.
+        M.util.js_pending(this.pendingid);
         this.fp = this.file_pickers();
         var tn = Y.one(this.get('topnode'));
         tn.one('div.fcontainer').append('<div class="ddarea"><div class="droparea"></div><div class="dragitems"></div>' +