@ -447,7 +447,7 @@ describe('ChoiceList', function() {
it ( 'should allow reasonable conversions between ChoiceList and other types' , async function ( ) {
it ( 'should allow reasonable conversions between ChoiceList and other types' , async function ( ) {
await gu . enterGridRows ( { rowNum : 1 , col : 'A' } ,
await gu . enterGridRows ( { rowNum : 1 , col : 'A' } ,
[ [ 'Hello' ] , [ 'World' ] , [ ' Foo,Bar;Baz!, '] ] ) ;
[ [ 'Hello' ] , [ 'World' ] , [ ' Foo,Bar;Baz!, "Qux, quux corge", "80\'s", '] ] ) ;
await testTextChoiceListConversions ( ) ;
await testTextChoiceListConversions ( ) ;
} ) ;
} ) ;
@ -468,17 +468,17 @@ describe('ChoiceList', function() {
// Check that choices got populated.
// Check that choices got populated.
await driver . find ( '.test-right-tab-field' ) . click ( ) ;
await driver . find ( '.test-right-tab-field' ) . click ( ) ;
assert . deepEqual ( await getChoiceLabels ( ) , [ 'Hello' , 'World' , 'Foo' , 'Bar;Baz!' ]) ;
assert . deepEqual ( await getChoiceLabels ( ) , [ 'Hello' , 'World' , 'Foo' , 'Bar;Baz!' , 'Qux, quux corge' , '80\'s' ]) ;
assert . deepEqual (
assert . deepEqual (
await getChoiceColors ( ) ,
await getChoiceColors ( ) ,
[ UNSET_FILL , UNSET_FILL , UNSET_FILL , UNSET_FILL ]
[ UNSET_FILL , UNSET_FILL , UNSET_FILL , UNSET_FILL , UNSET_FILL , UNSET_FILL ]
) ;
) ;
// Check that the result contains the right tags.
// Check that the result contains the right tags.
assert . deepEqual ( await gu . getVisibleGridCells ( { rowNums : [ 1 , 2 , 3 ] , cols : [ 'A' ] } ) , [
assert . deepEqual ( await gu . getVisibleGridCells ( { rowNums : [ 1 , 2 , 3 ] , cols : [ 'A' ] } ) , [
'Hello' ,
'Hello' ,
'World' ,
'World' ,
'Foo\nBar;Baz! '
'Foo\nBar;Baz! \nQux, quux corge\n80\'s '
] ) ;
] ) ;
await gu . checkForErrors ( ) ;
await gu . checkForErrors ( ) ;
@ -494,17 +494,21 @@ describe('ChoiceList', function() {
[
[
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
]
]
) ;
) ;
// Open a cell to see the actual tags.
// Open a cell to see the actual tags.
await gu . getCell ( { rowNum : 3 , col : 'A' } ) . click ( ) ;
await gu . getCell ( { rowNum : 3 , col : 'A' } ) . click ( ) ;
await driver . sendKeys ( Key . ENTER ) ;
await driver . sendKeys ( Key . ENTER ) ;
assert . deepEqual ( await getEditorTokens ( ) , [ 'Foo' , 'Bar;Baz!' ]) ;
assert . deepEqual ( await getEditorTokens ( ) , [ 'Foo' , 'Bar;Baz!' , 'Qux, quux corge' , '80\'s' ]) ;
assert . deepEqual ( await getEditorTokensIsInvalid ( ) , [ false , false ] ) ;
assert . deepEqual ( await getEditorTokensIsInvalid ( ) , [ false , false , false , false ] ) ;
assert . deepEqual (
assert . deepEqual (
await getEditorTokenStyles ( ) ,
await getEditorTokenStyles ( ) ,
[
[
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE } ,
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE }
{ fillColor : DEFAULT_FILL , textColor : DEFAULT_TEXT , . . . VALID_CHOICE }
]
]
@ -520,7 +524,7 @@ describe('ChoiceList', function() {
assert . deepEqual ( await gu . getVisibleGridCells ( { rowNums : [ 1 , 2 , 3 ] , cols : [ 'A' ] } ) , [
assert . deepEqual ( await gu . getVisibleGridCells ( { rowNums : [ 1 , 2 , 3 ] , cols : [ 'A' ] } ) , [
'Hello' ,
'Hello' ,
'World' ,
'World' ,
'Foo, Bar;Baz!, hooray'
'Foo, Bar;Baz!, "Qux, quux corge", 80\'s, hooray'
] ) ;
] ) ;
// Undo the cell change and both conversions (back to ChoiceList, back to Text), and check
// Undo the cell change and both conversions (back to ChoiceList, back to Text), and check
@ -529,7 +533,7 @@ describe('ChoiceList', function() {
assert . deepEqual ( await gu . getVisibleGridCells ( { rowNums : [ 1 , 2 , 3 ] , cols : [ 'A' ] } ) , [
assert . deepEqual ( await gu . getVisibleGridCells ( { rowNums : [ 1 , 2 , 3 ] , cols : [ 'A' ] } ) , [
'Hello' ,
'Hello' ,
'World' ,
'World' ,
' Foo,Bar;Baz!, ', // That's the text originally entered into this Text cell.
' Foo,Bar;Baz!, "Qux, quux corge", "80\'s", ', // That's the text originally entered into this Text cell.
] ) ;
] ) ;
}
}