This commit is contained in:
Eloy Lafuente (stronk7) 2015-09-25 11:31:14 +02:00
commit a9ed308f74
5 changed files with 17 additions and 10 deletions

View File

@ -1,4 +1,4 @@
@qtype @qtype_ddimageortext
@qtype @qtype_ddimageortext @_switch_window
Feature: Preview a drag-drop onto image question
As a teacher
In order to check my drag-drop onto image questions will work for students
@ -28,6 +28,9 @@ 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
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
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

View File

@ -83,10 +83,11 @@ class behat_qtype_ddmarker extends behat_base {
var container = document.querySelector('.droparea');
container.style.setProperty('position', 'relative');
container.insertBefore(target, image);
var xadjusted = {$x} + (container.offsetWidth - image.offsetWidth) / 2
var xadjusted = {$x} + (container.offsetWidth - image.offsetWidth) / 2;
var yadjusted = {$y} + (container.offsetHeight - image.offsetHeight) / 2;
target.style.setProperty('position', 'absolute');
target.style.setProperty('left', xadjusted + 'px');
target.style.setProperty('top', '{$y}px');
target.style.setProperty('top', yadjusted + 'px');
target.style.setProperty('width', '1px');
target.style.setProperty('height', '1px');
}())");

View File

@ -1,4 +1,4 @@
@qtype @qtype_ddmarker
@qtype @qtype_ddmarker @_switch_window
Feature: Preview a drag-drop onto image question
As a teacher
In order to check my drag-drop onto image questions will work for students
@ -28,11 +28,14 @@ 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
# Increase window size and wait 2 seconds to ensure elements are placed properly by js.
And I change window size to "medium"
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
And I drag "Railway station,1" to "324,317" in the drag and drop markers question
And I drag "Railway station,2" to "201,99" in the drag and drop markers question
And I drag "OU" to "342,230" in the drag and drop markers question
And I drag "Railway station" to "254,197" in the drag and drop markers question
And I drag "Railway station,1" to "326,319" in the drag and drop markers question
And I drag "Railway station,2" to "203,101" in the drag and drop markers question
And I press "Submit and finish"
Then the state of "Please place the markers on the map of Milton Keynes" question is shown as "Correct"
And I should see "Mark 1.00 out of 1.00"

View File

@ -1,4 +1,4 @@
@qtype @qtype_ddwtos
@qtype @qtype_ddwtos @_switch_window
Feature: Preview a drag-drop into text question
As a teacher
In order to check my drag-drop into text questions will work for students

View File

@ -1,4 +1,4 @@
@qtype @qtype_gapselect
@qtype @qtype_gapselect @_switch_window
Feature: Test all the basic functionality of this question type
In order to evaluate students responses, As a teacher I need to
create and preview gapselect (Select missing words) questions.