MDL-47494 ddimageortext: Update dd qtype tests to use js_pending not fixed waits #14895
This commit is contained in:
@@ -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
|
||||
|
||||
+5
-1
@@ -250,14 +250,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();
|
||||
@@ -293,6 +296,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) {
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
question/type/ddimageortext/yui/build/moodle-qtype_ddimageortext-dd/moodle-qtype_ddimageortext-dd.js
Vendored
+5
-1
@@ -250,14 +250,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();
|
||||
@@ -293,6 +296,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) {
|
||||
|
||||
+3
@@ -24,9 +24,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>' +
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
+3
@@ -24,9 +24,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>' +
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>' +
|
||||
|
||||
Reference in New Issue
Block a user