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
6c19f3a7
Commit
6c19f3a7
authored
Aug 21, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jsinput_spec back in.
parent
e30ebf50
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
common/static/js/capa/spec/jsinput_spec.js
+70
-0
No files found.
common/static/js/capa/spec/jsinput_spec.js
0 → 100644
View file @
6c19f3a7
xdescribe
(
"A jsinput has:"
,
function
()
{
beforeEach
(
function
()
{
$
(
'#fixture'
).
remove
();
$
.
ajax
({
async
:
false
,
url
:
'mainfixture.html'
,
success
:
function
(
data
)
{
$
(
'body'
).
append
(
$
(
data
));
}
});
});
describe
(
"The jsinput constructor"
,
function
(){
var
iframe1
=
$
(
document
).
find
(
'iframe'
)[
0
];
var
testJsElem
=
jsinputConstructor
({
id
:
1
,
elem
:
iframe1
,
passive
:
false
});
it
(
"Returns an object"
,
function
(){
expect
(
typeof
(
testJsElem
)).
toEqual
(
'object'
);
});
it
(
"Adds the object to the jsinput array"
,
function
()
{
expect
(
jsinput
.
exists
(
1
)).
toBe
(
true
);
});
describe
(
"The returned object"
,
function
()
{
it
(
"Has a public 'update' method"
,
function
(){
expect
(
testJsElem
.
update
).
toBeDefined
();
});
it
(
"Returns an 'update' that is idempotent"
,
function
(){
var
orig
=
testJsElem
.
update
();
for
(
var
i
=
0
;
i
++
;
i
<
5
)
{
expect
(
testJsElem
.
update
()).
toEqual
(
orig
);
}
});
it
(
"Changes the parent's inputfield"
,
function
()
{
testJsElem
.
update
();
});
});
});
describe
(
"The walkDOM functions"
,
function
()
{
walkDOM
();
it
(
"Creates (at least) one object per iframe"
,
function
()
{
jsinput
.
arr
.
length
>=
2
;
});
it
(
"Does not create multiple objects with the same id"
,
function
()
{
while
(
jsinput
.
arr
.
length
>
0
)
{
var
elem
=
jsinput
.
arr
.
pop
();
expect
(
jsinput
.
exists
(
elem
.
id
)).
toBe
(
false
);
}
});
});
})
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