@@ -168,16 +168,37 @@ describe('TypeaheadTokenizer Component', function() {
168168 this . component . focus ( ) ;
169169 assert . equal ( this . component . refs . typeahead . focus . calledOnce , true ) ;
170170 } ) ;
171- } ) ;
172171
173- it ( 'should provide an exposed component function to get the selected tokens' , function ( ) {
174- simulateTokenInput ( this . component , 'o' ) ;
175- var entry = this . component . refs . typeahead . refs . entry . getDOMNode ( ) ;
176- TestUtils . Simulate . keyDown ( entry , { keyCode : Keyevent . DOM_VK_DOWN } ) ;
177- TestUtils . Simulate . keyDown ( entry , { keyCode : Keyevent . DOM_VK_RETURN } ) ;
172+ it ( 'should provide an exposed component function to get the selected tokens' , function ( ) {
173+ simulateTokenInput ( this . component , 'o' ) ;
174+ var entry = this . component . refs . typeahead . refs . entry . getDOMNode ( ) ; ;
175+ TestUtils . Simulate . keyDown ( entry , { keyCode : Keyevent . DOM_VK_DOWN } ) ;
176+ TestUtils . Simulate . keyDown ( entry , { keyCode : Keyevent . DOM_VK_RETURN } ) ;
178177
179- assert . equal ( this . component . getSelectedTokens ( ) . length , 1 ) ;
180- assert . equal ( this . component . getSelectedTokens ( ) [ 0 ] , "John" ) ;
178+ assert . equal ( this . component . getSelectedTokens ( ) . length , 1 ) ;
179+ assert . equal ( this . component . getSelectedTokens ( ) [ 0 ] , "John" ) ;
180+ } ) ;
181+
182+ it ( 'should provide an exposed component function to add tokens' , function ( ) {
183+ this . component . addSelectedToken ( "John" )
184+ assert . equal ( this . component . getSelectedTokens ( ) . length , 1 ) ;
185+ assert . equal ( this . component . getSelectedTokens ( ) [ 0 ] , "John" ) ;
186+ } ) ;
187+
188+ it ( 'should provide an exposed component function to remove tokens' , function ( ) {
189+ this . component . addSelectedToken ( "John" )
190+ assert . equal ( this . component . getSelectedTokens ( ) . length , 1 ) ;
191+ this . component . removeSelectedToken ( "John" )
192+ assert . equal ( this . component . getSelectedTokens ( ) . length , 0 ) ;
193+ } ) ;
194+
195+ it ( 'should provide an exposed component function to remove tokens' , function ( ) {
196+ this . component . addSelectedToken ( "John" )
197+ this . component . setSelectedTokens ( [ "Paul" , "George" ] )
198+ assert . equal ( this . component . getSelectedTokens ( ) . length , 2 ) ;
199+ assert . equal ( this . component . getSelectedTokens ( ) [ 0 ] , "Paul" ) ;
200+ assert . equal ( this . component . getSelectedTokens ( ) [ 1 ] , "George" ) ;
201+ } ) ;
181202 } ) ;
182203
183204 describe ( 'keyboard controls' , function ( ) {
0 commit comments