@@ -198,34 +198,35 @@ new Test.Unit.Runner({
198
198
199
199
testElementMethodInsert : function ( ) {
200
200
$ ( 'element-insertions-main' ) . insert ( { before :'some text before' } ) ;
201
- this . assert ( getInnerHTML ( 'element-insertions-container' ) . startsWith ( 'some text before' ) ) ;
201
+ this . assert ( getInnerHTML ( 'element-insertions-container' ) . startsWith ( 'some text before' ) , 'some text before' ) ;
202
202
$ ( 'element-insertions-main' ) . insert ( { after :'some text after' } ) ;
203
- this . assert ( getInnerHTML ( 'element-insertions-container' ) . endsWith ( 'some text after' ) ) ;
203
+ this . assert ( getInnerHTML ( 'element-insertions-container' ) . endsWith ( 'some text after' ) , 'some text after' ) ;
204
204
$ ( 'element-insertions-main' ) . insert ( { top :'some text top' } ) ;
205
- this . assert ( getInnerHTML ( 'element-insertions-main' ) . startsWith ( 'some text top' ) ) ;
205
+ this . assert ( getInnerHTML ( 'element-insertions-main' ) . startsWith ( 'some text top' ) , 'some text top' ) ;
206
206
$ ( 'element-insertions-main' ) . insert ( { bottom :'some text bottom' } ) ;
207
- this . assert ( getInnerHTML ( 'element-insertions-main' ) . endsWith ( 'some text bottom' ) ) ;
207
+ this . assert ( getInnerHTML ( 'element-insertions-main' ) . endsWith ( 'some text bottom' ) , 'some text bottom' ) ;
208
208
209
209
$ ( 'element-insertions-main' ) . insert ( 'some more text at the bottom' ) ;
210
- this . assert ( getInnerHTML ( 'element-insertions-main' ) . endsWith ( 'some more text at the bottom' ) ) ;
210
+ this . assert ( getInnerHTML ( 'element-insertions-main' ) . endsWith ( 'some more text at the bottom' ) ,
211
+ 'some more text at the bottom' ) ;
211
212
212
213
$ ( 'element-insertions-main' ) . insert ( { TOP :'some text uppercase top' } ) ;
213
- this . assert ( getInnerHTML ( 'element-insertions-main' ) . startsWith ( 'some text uppercase top' ) ) ;
214
+ this . assert ( getInnerHTML ( 'element-insertions-main' ) . startsWith ( 'some text uppercase top' ) , 'some text uppercase top' ) ;
214
215
215
216
$ ( 'element-insertions-multiple-main' ) . insert ( {
216
217
top :'1' , bottom :2 , before : new Element ( 'p' ) . update ( '3' ) , after :'4'
217
218
} ) ;
218
- this . assert ( getInnerHTML ( 'element-insertions-multiple-main' ) . startsWith ( '1' ) ) ;
219
- this . assert ( getInnerHTML ( 'element-insertions-multiple-main' ) . endsWith ( '2' ) ) ;
220
- this . assert ( getInnerHTML ( 'element-insertions-multiple-container' ) . startsWith ( '<p>3</p>' ) ) ;
221
- this . assert ( getInnerHTML ( 'element-insertions-multiple-container' ) . endsWith ( '4' ) ) ;
219
+ this . assert ( getInnerHTML ( 'element-insertions-multiple-main' ) . startsWith ( '1' ) , '1' ) ;
220
+ this . assert ( getInnerHTML ( 'element-insertions-multiple-main' ) . endsWith ( '2' ) , '2' ) ;
221
+ this . assert ( getInnerHTML ( 'element-insertions-multiple-container' ) . startsWith ( '<p>3</p>' ) , '<p>3</p>' ) ;
222
+ this . assert ( getInnerHTML ( 'element-insertions-multiple-container' ) . endsWith ( '4' ) , '4' ) ;
222
223
223
224
$ ( 'element-insertions-main' ) . update ( 'test' ) ;
224
225
$ ( 'element-insertions-main' ) . insert ( null ) ;
225
226
$ ( 'element-insertions-main' ) . insert ( { bottom :null } ) ;
226
- this . assertEqual ( 'test' , getInnerHTML ( 'element-insertions-main' ) ) ;
227
+ this . assertEqual ( 'test' , getInnerHTML ( 'element-insertions-main' ) , 'should insert nothing when called with null' ) ;
227
228
$ ( 'element-insertions-main' ) . insert ( 1337 ) ;
228
- this . assertEqual ( 'test1337' , getInnerHTML ( 'element-insertions-main' ) ) ;
229
+ this . assertEqual ( 'test1337' , getInnerHTML ( 'element-insertions-main' ) , 'should coerce to string when called with number' ) ;
229
230
} ,
230
231
231
232
testNewElementInsert : function ( ) {
@@ -988,14 +989,26 @@ new Test.Unit.Runner({
988
989
$ ( 'op3' ) . setStyle ( { opacity : 0 } ) ;
989
990
this . assertEqual ( 0 , $ ( 'op3' ) . getStyle ( 'opacity' ) , 'get opacity on #op3' ) ;
990
991
991
- if ( navigator . appVersion . match ( / M S I E / ) ) {
992
+ // Opacity feature test borrowed from Modernizr.
993
+ var STANDARD_CSS_OPACITY_SUPPORTED = ( function ( ) {
994
+ var DIV = document . createElement ( 'div' ) ;
995
+ DIV . style . cssText = "opacity:.55" ;
996
+ var result = / ^ 0 .5 5 / . test ( DIV . style . opacity ) ;
997
+ DIV = null ;
998
+ return result ;
999
+ } ) ( ) ;
1000
+
1001
+ if ( ! STANDARD_CSS_OPACITY_SUPPORTED ) {
1002
+ // Run these tests only on older versions of IE. IE9 and 10 dropped
1003
+ // support for filters and therefore fail these tests.
992
1004
this . assertEqual ( 'alpha(opacity=30)' , $ ( 'op1' ) . getStyle ( 'filter' ) ) ;
993
1005
this . assertEqual ( 'progid:DXImageTransform.Microsoft.Blur(strength=10)alpha(opacity=30)' , $ ( 'op2' ) . getStyle ( 'filter' ) ) ;
994
1006
$ ( 'op2' ) . setStyle ( { opacity :'' } ) ;
995
1007
this . assertEqual ( 'progid:DXImageTransform.Microsoft.Blur(strength=10)' , $ ( 'op2' ) . getStyle ( 'filter' ) ) ;
996
1008
this . assertEqual ( 'alpha(opacity=0)' , $ ( 'op3' ) . getStyle ( 'filter' ) ) ;
997
1009
this . assertEqual ( 0.3 , $ ( 'op4-ie' ) . getStyle ( 'opacity' ) ) ;
998
1010
}
1011
+
999
1012
// verify that value is still found when using camelized
1000
1013
// strings (function previously used getPropertyValue()
1001
1014
// which expected non-camelized strings)
0 commit comments