Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
2cee94ea
Commit
2cee94ea
authored
Jan 27, 2014
by
polesye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BLD-711: Fix offest in FF.
parent
42933739
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
28 deletions
+15
-28
CHANGELOG.rst
+2
-0
common/lib/xmodule/xmodule/js/spec/capa/imageinput_spec.js
+5
-15
common/lib/xmodule/xmodule/js/src/capa/imageinput.js
+8
-13
No files found.
CHANGELOG.rst
View file @
2cee94ea
...
...
@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
Blades: Fix bug when image response in Firefox does not retain input. BLD-711.
Blades: Give numerical response tolerance as a range. BLD-25.
Blades: Allow user with BetaTester role correctly use LTI. BLD-641.
...
...
common/lib/xmodule/xmodule/js/spec/capa/imageinput_spec.js
View file @
2cee94ea
...
...
@@ -18,13 +18,9 @@
el
.
append
(
createTestImage
(
'cross_12345'
,
300
,
400
,
'red'
));
state
=
new
ImageInput
(
'12345'
);
spyOn
(
state
,
'clickHandler'
).
andCallThrough
();
});
it
(
'initialization'
,
function
()
{
expect
(
state
.
elementId
).
toBe
(
'12345'
);
// Check that object's properties are present, and that the DOM
// elements they reference exist.
expect
(
state
.
el
).
toBeDefined
();
...
...
@@ -36,12 +32,7 @@
expect
(
state
.
inputEl
).
toBeDefined
();
expect
(
state
.
inputEl
).
toExist
();
// Check that the click handler has been attached to the `state.el`
// element. Note that `state.clickHandler()` method is called from
// within the attached handler. That is why we can't use
// Jasmine-jQuery `toHandleWith()` method.
state
.
el
.
click
();
expect
(
state
.
clickHandler
).
toHaveBeenCalled
();
expect
(
state
.
el
).
toHandle
(
'click'
);
});
it
(
'cross becomes visible after first click'
,
function
()
{
...
...
@@ -81,7 +72,8 @@
});
it
(
'coordinates are updated [offsetX is NOT set]'
,
function
()
{
var
event
,
posX
,
posY
,
cssLeft
,
cssTop
;
var
offset
=
state
.
el
.
offset
(),
event
,
posX
,
posY
,
cssLeft
,
cssTop
;
// Set up of 'click' event.
event
=
jQuery
.
Event
(
...
...
@@ -91,12 +83,10 @@
pageX
:
35.3
,
pageY
:
42.7
}
);
state
.
el
[
0
].
offsetLeft
=
12
;
state
.
el
[
0
].
offsetTop
=
3
;
// Calculating the expected coordinates.
posX
=
event
.
pageX
-
state
.
el
[
0
].
offsetL
eft
;
posY
=
event
.
pageY
-
state
.
el
[
0
].
offsetT
op
;
posX
=
event
.
pageX
-
offset
.
l
eft
;
posY
=
event
.
pageY
-
offset
.
t
op
;
// Triggering 'click' event.
jQuery
(
state
.
el
).
trigger
(
event
);
...
...
common/lib/xmodule/xmodule/js/src/capa/imageinput.js
View file @
2cee94ea
...
...
@@ -24,24 +24,19 @@ window.ImageInput = (function ($, undefined) {
return
ImageInput
;
function
ImageInputConstructor
(
elementId
)
{
var
_this
=
this
;
this
.
el
=
$
(
'#imageinput_'
+
elementId
);
this
.
crossEl
=
$
(
'#cross_'
+
elementId
);
this
.
inputEl
=
$
(
'#input_'
+
elementId
);
this
.
elementId
=
elementId
;
this
.
el
=
$
(
'#imageinput_'
+
this
.
elementId
);
this
.
crossEl
=
$
(
'#cross_'
+
this
.
elementId
);
this
.
inputEl
=
$
(
'#input_'
+
this
.
elementId
);
this
.
el
.
on
(
'click'
,
function
(
event
)
{
_this
.
clickHandler
(
event
);
});
this
.
el
.
on
(
'click'
,
this
.
clickHandler
.
bind
(
this
));
}
function
clickHandler
(
event
)
{
var
posX
=
event
.
offsetX
?
event
.
offsetX
:
event
.
pageX
-
this
.
el
[
0
].
offsetLeft
,
var
offset
=
this
.
el
.
offset
(),
posX
=
event
.
offsetX
?
event
.
offsetX
:
event
.
pageX
-
offset
.
left
,
posY
=
event
.
offsetY
?
event
.
offsetY
:
event
.
pageY
-
this
.
el
[
0
].
offsetT
op
,
event
.
offsetY
:
event
.
pageY
-
offset
.
t
op
,
// To reduce differences between values returned by different kinds
// of browsers, we round `posX` and `posY`.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment