Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
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
夏彬
jquery
Commits
659ac9c1
Commit
659ac9c1
authored
Jan 16, 2014
by
Oleg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: Add assertion for the jQuery#val method
parent
fdd78fad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
attributes.js
test/unit/attributes.js
+7
-2
No files found.
test/unit/attributes.js
View file @
659ac9c1
...
@@ -926,7 +926,7 @@ if ( "value" in document.createElement("meter") &&
...
@@ -926,7 +926,7 @@ if ( "value" in document.createElement("meter") &&
}
}
var
testVal
=
function
(
valueObj
)
{
var
testVal
=
function
(
valueObj
)
{
expect
(
8
);
expect
(
9
);
jQuery
(
"#text1"
).
val
(
valueObj
(
"test"
)
);
jQuery
(
"#text1"
).
val
(
valueObj
(
"test"
)
);
equal
(
document
.
getElementById
(
"text1"
).
value
,
"test"
,
"Check for modified (via val(String)) value of input element"
);
equal
(
document
.
getElementById
(
"text1"
).
value
,
"test"
,
"Check for modified (via val(String)) value of input element"
);
...
@@ -941,7 +941,9 @@ var testVal = function( valueObj ) {
...
@@ -941,7 +941,9 @@ var testVal = function( valueObj ) {
equal
(
document
.
getElementById
(
"text1"
).
value
,
""
,
"Check for modified (via val(null)) value of input element"
);
equal
(
document
.
getElementById
(
"text1"
).
value
,
""
,
"Check for modified (via val(null)) value of input element"
);
var
j
,
var
j
,
$select1
=
jQuery
(
"#select1"
);
select
=
jQuery
(
"<select multiple><option value='1'/><option value='2'/></select>"
);
$select1
=
jQuery
(
"#select1"
),
$select1
.
val
(
valueObj
(
"3"
)
);
$select1
.
val
(
valueObj
(
"3"
)
);
equal
(
$select1
.
val
(),
"3"
,
"Check for modified (via val(String)) value of select element"
);
equal
(
$select1
.
val
(),
"3"
,
"Check for modified (via val(String)) value of select element"
);
...
@@ -957,6 +959,9 @@ var testVal = function( valueObj ) {
...
@@ -957,6 +959,9 @@ var testVal = function( valueObj ) {
j
.
val
(
valueObj
(
"asdf"
)
);
j
.
val
(
valueObj
(
"asdf"
)
);
equal
(
j
.
val
(),
"asdf"
,
"Check node,textnode,comment with val()"
);
equal
(
j
.
val
(),
"asdf"
,
"Check node,textnode,comment with val()"
);
j
.
removeAttr
(
"value"
);
j
.
removeAttr
(
"value"
);
select
.
val
(
valueObj
(
[
"1"
,
"2"
]
)
);
deepEqual
(
select
.
val
(),
[
"1"
,
"2"
],
"Should set array of values"
);
};
};
test
(
"val(String/Number)"
,
function
()
{
test
(
"val(String/Number)"
,
function
()
{
...
...
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