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
b9b5c23f
Commit
b9b5c23f
authored
May 05, 2015
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Effects: add tests for jQuery.easing._default in Animation and Tween
Ref gh-2219
parent
b7f9e626
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
25 deletions
+80
-25
effects.js
test/unit/effects.js
+80
-25
No files found.
test/unit/effects.js
View file @
b9b5c23f
...
@@ -1143,49 +1143,49 @@ test( "interrupt toggle", function() {
...
@@ -1143,49 +1143,49 @@ test( "interrupt toggle", function() {
});
});
},
shortDuration
);
},
shortDuration
);
});
});
clock
.
tick
(
longDuration
);
clock
.
tick
(
longDuration
);
//FIXME untangle the set timeouts
// FIXME untangle the set timeouts
});
});
test
(
"animate with per-property easing"
,
function
()
{
test
(
"animate with per-property easing"
,
function
()
{
expect
(
5
);
expect
(
5
);
var
data
=
{
a
:
0
,
b
:
0
,
c
:
0
},
var
data
=
{
a
:
0
,
b
:
0
,
c
:
0
},
_test1_c
alled
=
false
,
test1C
alled
=
false
,
_test2_c
alled
=
false
,
test2C
alled
=
false
,
_default_test_c
alled
=
false
,
defaultTestC
alled
=
false
,
props
=
{
props
=
{
a
:
[
100
,
"_test1"
],
a
:
[
100
,
"_test1"
],
b
:
[
100
,
"_test2"
],
b
:
[
100
,
"_test2"
],
c
:
100
c
:
100
};
};
jQuery
.
easing
[
"_test1"
]
=
function
(
p
)
{
jQuery
.
easing
.
_test1
=
function
(
p
)
{
_test1_c
alled
=
true
;
test1C
alled
=
true
;
return
p
;
return
p
;
};
};
jQuery
.
easing
[
"_test2"
]
=
function
(
p
)
{
jQuery
.
easing
.
_test2
=
function
(
p
)
{
_test2_c
alled
=
true
;
test2C
alled
=
true
;
return
p
;
return
p
;
};
};
jQuery
.
easing
[
"_default_test"
]
=
function
(
p
)
{
jQuery
.
easing
.
_defaultTest
=
function
(
p
)
{
_default_test_c
alled
=
true
;
defaultTestC
alled
=
true
;
return
p
;
return
p
;
};
};
jQuery
(
data
).
animate
(
props
,
400
,
"_default_test"
,
function
(){
jQuery
(
data
).
animate
(
props
,
400
,
"_defaultTest"
,
function
()
{
ok
(
test1Called
,
"Easing function (_test1) called"
);
ok
(
_test1_called
,
"Easing function (_test1) called"
);
ok
(
test2Called
,
"Easing function (_test2) called"
);
ok
(
_test2_called
,
"Easing function (_test2) called"
);
ok
(
defaultTestCalled
,
"Easing function (_default) called"
);
ok
(
_default_test_called
,
"Easing function (_default) called"
);
equal
(
props
.
a
[
1
],
"_test1"
,
"animate does not change original props (per-property easing would be lost)"
);
equal
(
props
.
a
[
1
],
"_test1"
,
"animate does not change original props (per-property easing would be lost)"
);
equal
(
props
.
b
[
1
],
"_test2"
,
"animate does not change original props (per-property easing would be lost)"
);
equal
(
props
.
b
[
1
],
"_test2"
,
"animate does not change original props (per-property easing would be lost)"
);
});
});
this
.
clock
.
tick
(
400
);
this
.
clock
.
tick
(
400
);
});
});
test
(
"animate with CSS shorthand properties"
,
function
(){
test
(
"animate with CSS shorthand properties"
,
function
(){
...
@@ -2227,16 +2227,18 @@ test( "Animation should go to its end state if document.hidden = true", 1, funct
...
@@ -2227,16 +2227,18 @@ test( "Animation should go to its end state if document.hidden = true", 1, funct
}
}
});
});
test
(
"jQuery.easing._default (#2218)"
,
2
,
function
()
{
test
(
"jQuery.easing._default (gh-2218)"
,
function
()
{
expect
(
2
);
jQuery
(
"#foo"
)
jQuery
(
"#foo"
)
.
animate
({
width
:
"5px"
},
{
.
animate
(
{
width
:
"5px"
},
{
duration
:
5
,
duration
:
5
,
start
:
function
(
anim
)
{
start
:
function
(
anim
)
{
equal
(
anim
.
opts
.
easing
,
jQuery
.
easing
.
_default
,
equal
(
anim
.
opts
.
easing
,
jQuery
.
easing
.
_default
,
"anim.opts.easing should be equal to jQuery.easing._default when the easing argument is not given"
);
"anim.opts.easing should be equal to jQuery.easing._default when the easing argument is not given"
);
}
}
})
})
.
animate
({
height
:
"5px"
},
{
.
animate
(
{
height
:
"5px"
},
{
duration
:
5
,
duration
:
5
,
easing
:
"linear"
,
easing
:
"linear"
,
start
:
function
(
anim
)
{
start
:
function
(
anim
)
{
...
@@ -2245,7 +2247,60 @@ test( "jQuery.easing._default (#2218)", 2, function() {
...
@@ -2245,7 +2247,60 @@ test( "jQuery.easing._default (#2218)", 2, function() {
}
}
})
})
.
stop
();
.
stop
();
this
.
clock
.
tick
(
25
);
this
.
clock
.
tick
(
25
);
});
});
test
(
"jQuery.easing._default in Animation (gh-2218"
,
function
()
{
expect
(
3
);
var
animation
,
defaultEasing
=
jQuery
.
easing
.
_default
,
called
=
false
,
testObject
=
{
"width"
:
100
},
testDest
=
{
"width"
:
200
};
jQuery
.
easing
.
custom
=
function
(
p
)
{
called
=
true
;
return
p
;
};
jQuery
.
easing
.
_default
=
"custom"
;
animation
=
jQuery
.
Animation
(
testObject
,
testDest
,
{
"duration"
:
1
}
);
animation
.
done
(
function
()
{
equal
(
testObject
.
width
,
testDest
.
width
,
"Animated width"
);
ok
(
called
,
"Custom jQuery.easing._default called"
);
strictEqual
(
animation
.
opts
.
easing
,
"custom"
,
"Animation used custom jQuery.easing._default"
);
jQuery
.
easing
.
_default
=
defaultEasing
;
delete
jQuery
.
easing
.
custom
;
});
this
.
clock
.
tick
(
10
);
});
test
(
"jQuery.easing._default in Tween (gh-2218)"
,
function
()
{
expect
(
3
);
var
tween
,
defaultEasing
=
jQuery
.
easing
.
_default
,
called
=
false
,
testObject
=
{
"width"
:
100
};
jQuery
.
easing
.
custom
=
function
(
p
)
{
called
=
true
;
return
p
;
};
jQuery
.
easing
.
_default
=
"custom"
;
tween
=
jQuery
.
Tween
(
testObject
,
{
"duration"
:
1
},
"width"
,
200
);
tween
.
run
(
1
);
equal
(
testObject
.
width
,
200
,
"Animated width"
);
ok
(
called
,
"Custom jQuery.easing._default called"
);
strictEqual
(
tween
.
easing
,
"custom"
,
"Animation used custom jQuery.easing._default"
);
jQuery
.
easing
.
_default
=
defaultEasing
;
delete
jQuery
.
easing
.
custom
;
});
})();
})();
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