10000 Make tests a little more liberal. · f2er/jquery.transit@8993f57 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8993f57

Browse files
committed
Make tests a little more liberal.
1 parent 4d3819e commit 8993f57

File tree

1 file changed

+57
-3
lines changed

1 file changed

+57
-3
lines changed

site/test.haml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ title: Hello
1010
%script(src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js')
1111
%script(src='jquery.transit.min.js')
1212
%script(src='script.js')
13+
:javascript
14+
jQuery.fn.bounceIn = function(callback) {
15+
return this.
16+
css({ scale: 0.9, opacity: 0 }).
17+
transit({ scale: 1.03, opacity: 1 }, 120, 'out').
18+
transit({ scale: 1.0 }, 200, 'in', callback);
19+
};
20+
21+
jQuery.fn.bounceOut = function(callback) {
22+
return this.
23+
css({ opacity: 1 }).
24+
transit({ scale: 0.97, opacity: 0 }, 120, 'in', callback);
25+
};
26+
1327
%body
1428
#all
1529
%hgroup#header
@@ -109,6 +123,44 @@ title: Hello
109123
.field{style: 'height: 150px; overflow: hidden;'}
110124
.box{style: 'left: 10px; top: 10px; width: 380px; height: 130px;'}
111125

126+
-# ============================================================================
127+
%h2 Lingering test
128+
129+
%article
130+
.hover
131+
.code
132+
%h3 Don't animate 'left'
133+
%pre
134+
!= "$('.box')."
135+
%br<>
136+
!= " css({ position: 'absolute', left: '500px', opacity: 0 }, <b>0</b>);"
137+
%br<>
138+
!= "window.setTimeout(function() {"
139+
%br<>
140+
!= " $('.box')."
141+
%br<>
142+
!= " css({ left: 10 })."
143+
%br<>
144+
!= " transition({ opacity: 1 });"
145+
%br<>
146+
!= "}, 200);"
147+
148+
.field{style: 'height: 150px; overflow: hidden;'}
149+
.box{style: 'left: 10px; top: 10px; width: 380px; height: 130px;'}
150+
151+
-# ============================================================================
152+
%h2 Bounce?
153+
154+
%article
155+
.hover
156+
.code
157+
%h3 In
158+
%pre
159+
!= "$('.box').bounceIn();"
160+
161+
.field
162+
.box{style: 'left: 180px; top: 20px;'}
163+
112164
-# ============================================================================
113165
%h2 Translate (move)
114166

@@ -691,14 +743,16 @@ title: Hello
691743
div.transition({ left: 40, marginLeft: 10, rotate: 30 }, 400, 'ease');
692744
window.setTimeout(function() {
693745
var t = getTransition(div[0]);
694-
a(t == 'left 400ms ease, margin 400ms ease, ' + uncamel($.support.transform) + ' 400ms ease');
746+
a(t.indexOf('left 400ms ease') > -1);
747+
a(t.indexOf('margin 400ms ease') > -1);
748+
a(t.indexOf(uncamel($.support.transform) + ' 400ms ease') > -1);
695749
}, 200);
696750
},
697751

698752
get_transition_value: function(a) {
699753
var t = $.transit.getTransitionValue({ opacity: 0, skewX: 30 }, 500, 'in');
700-
console.log(t, '///', 'opacity 500ms ease-in, ' + uncamel($.support.transform) + ' 500ms ease-in');
701-
a(t == 'opacity 500ms ease-in, ' + uncamel($.support.transform) + ' 500ms ease-in');
754+
a(t.indexOf('opacity 500ms ease-in') > -1);
755+
a(t.indexOf(uncamel($.support.transform) + ' 500ms ease-in') > -1);
702756
}
703757

704758
});

0 commit comments

Comments
 (0)
0