@@ -211,7 +211,7 @@ var mytests = function() {
211
211
// ref: https://www.w3.org/TR/webdatabase/#database-query-results
212
212
rs . insertId = 2 ;
213
213
rs . rowsAffected = 3 ;
214
- if ( isWebSql ) {
214
+ if ( isWebSql || isBrowser ) {
215
215
expect ( rs . insertId ) . toBe ( 1 ) ;
216
216
expect ( rs . rowsAffected ) . toBe ( 1 ) ;
217
217
} else {
@@ -240,7 +240,7 @@ var mytests = function() {
240
240
// rs.rows.length should be immutable
241
241
// ref: https://www.w3.org/TR/webdatabase/#database-query-results
242
242
rs . rows . length = 2 ;
243
- if ( isWebSql ) {
243
+ if ( isWebSql || isBrowser ) {
244
244
expect ( rs . rows . length ) . toBe ( 1 ) ;
245
245
} else {
246
246
expect ( rs . rows . length ) . toBe ( 2 ) ;
@@ -313,15 +313,21 @@ var mytests = function() {
313
313
// Object from rows.item is immutable in Android/iOS WebKit Web SQL but NOT in this plugin:
314
314
temp1 . data = 'another' ;
315
315
316
- if ( isWebSql ) {
316
+ if ( isBrowser ) {
317
+ // PLUGIN on browser platform:
318
+ // 1. DEVIATION - temp1 is just like any other Javascript object:
319
+ expect ( temp1 . data ) . toBe ( 'another' ) ;
320
+ // 2. According to Web SQL STANDARD - object returned by second resultSet.rows.item call not affected:
321
+ expect ( temp2 . data ) . toBe ( 'test' ) ;
322
+ } else if ( isWebSql ) {
317
323
// Web SQL STANDARD:
318
324
// 1. this is a native object that is NOT affected by the change (SKIP for Android 5.x/+):
319
325
if ( ! isAndroid || / A n d r o i d [ 1 - 4 ] / . test ( navigator . userAgent ) )
320
326
expect ( temp1 . data ) . toBe ( 'test' ) ;
321
327
// 2. object returned by second resultSet.rows.item call not affected:
322
328
expect ( temp2 . data ) . toBe ( 'test' ) ;
323
329
} else {
324
- // PLUGIN:
330
+ // PLUGIN on other platforms :
325
331
// 1. DEVIATION - temp1 is just like any other Javascript object:
326
332
expect ( temp1 . data ) . toBe ( 'another' ) ;
327
333
// 2. DEVIATION - same object is returned by second resultSet.rows.item IS affected:
@@ -667,12 +673,17 @@ var mytests = function() {
667
673
// CORRECT RESULT:
668
674
//expect(resultSet.rows.length).toBe(2);
669
675
// ACTUAL RESULT for PLUGIN [BROKEN with possible parameter data loss]:
670
- expect ( resultSet . rows . length ) . toBe ( 1 ) ;
671
-
672
- // FIRST ROW CORRECT:
673
- expect ( resultSet . rows . item ( 0 ) . data ) . toBe ( 1 ) ;
674
- // SECOND ROW MISSING:
675
- //expect(resultSet.rows.item(1).data).toBe(2);
676
+ if ( isBrowser ) {
677
+ // NO ROWS STORED ON BROWSER PLATFORM:
678
+ expect ( resultSet . rows . length ) . toBe ( 0 ) ;
679
+ } else ( isBrowser ) {
680
+ expect ( resultSet . rows . length ) . toBe ( 1 ) ;
681
+
682
+ // FIRST ROW CORRECT:
683
+ expect ( resultSet . rows . item ( 0 ) . data ) . toBe ( 1 ) ;
684
+ // SECOND ROW MISSING:
685
+ //expect(resultSet.rows.item(1).data).toBe(2);
686
+ }
676
687
677
688
// Close (plugin only) & finish:
678
689
( isWebSql ) ? done ( ) : db . close ( done , done ) ;
@@ -681,7 +692,7 @@ var mytests = function() {
681
692
} ) ;
682
693
} , MYTIMEOUT ) ;
683
694
684
- it ( suiteName + 'executeSql with SELECT statement list - NOT ALLOWED [PLUGIN BROKEN]' , function ( done ) {
695
+ it ( suiteName + 'executeSql with SELECT statement list - NOT ALLOWED [Android/iOS/macOS/Windows PLUGIN BROKEN]' , function ( done ) {
685
696
// TO FIX ref: https://www.sqlite.org/c3ref/prepare.html
686
697
// When calling sqlite3_prepare_v2 check the OUT pzTail pointer
687
698
// to ensure there is no other statement afterwards.
@@ -694,6 +705,8 @@ var mytests = function() {
694
705
// INCORRECT (PLUGIN BROKEN)
695
706
if ( isWebSql )
696
707
expect ( 'WebKit Web SQL implementation changed (DEVIATION)' ) . toBe ( '--' ) ;
708
+ else if ( isBrowser )
709
+ expect ( 'Browser platform implementation changed (DEVIATION)' ) . toBe ( '--' ) ;
697
710
else
698
711
expect ( rs ) . toBeDefined ( ) ;
699
712
@@ -708,7 +721,7 @@ var mytests = function() {
708
721
isWebSql ? done ( ) : db . close ( done , done ) ;
709
722
} ) ;
710
723
} , function ( ignored , error ) {
711
- if ( ! isWebSql )
724
+ if ( ! isWebSql && ! isBrowser )
712
725
expect ( 'PLUGIN FIXED, please update this test' ) . toBe ( '--' ) ;
713
726
714
727
expect ( error ) . toBeDefined ( ) ;
@@ -886,7 +899,7 @@ var mytests = function() {
886
899
887
900
} ) ;
888
901
889
- it ( suiteName + 'INSERT OR IGNORE result in case of constraint violation [(WebKit) Web SQL DEVIATION on Android/iOS : reports old insertId value]' , function ( done ) {
902
+ it ( suiteName + 'INSERT OR IGNORE result in case of constraint violation [Android/iOS (WebKit) Web SQL & browser plugin DEVIATION : reports old insertId value]' , function ( done ) {
890
903
var db = openDatabase ( 'INSERT-OR-IGNORE-test.db' , '1.0' , 'Test' , DEFAULT_SIZE ) ;
891
904
892
905
db . transaction ( function ( tx ) {
@@ -917,8 +930,8 @@ var mytests = function() {
917
930
// NOTE: According to https://www.w3.org/TR/webdatabase/#database-query-results (section 4.5)
918
931
// this access should really raise an INVALID_ACCESS_ERR exception.
919
932
var checkInsertId = rs1 . insertId ;
920
- if ( isWebSql )
921
- expect ( checkInsertId ) . toBe ( 2 ) ; // Andriod/iOS WebKit Web SQL DEVIATION: OLD insertId value
933
+ if ( isWebSql || isBrowser )
934
+ expect ( checkInsertId ) . toBe ( 2 ) ; // Andriod/iOS WebKit Web SQL & browser plugin DEVIATION: OLD insertId value
922
935
else
923
936
expect ( checkInsertId ) . toBe ( undefined ) ;
924
937
0 commit comments