1414describe ( 'License input field' , function ( ) {
1515 beforeEach ( function ( ) {
1616 cy . window ( ) . then ( ( win ) => {
17- win . sessionStorage . clear ( )
17+ win . sessionStorage . clear ( ) ;
18+ win . document . getElementById ( 'selected-licenses' ) . innerHTML = '' ;
1819 } )
1920 cy . visit ( './index.html' ) ;
2021 cy . get ( '#license' ) . should ( 'exist' ) ;
2122 cy . get ( '#selected-licenses' ) . should ( 'exist' ) ;
23+ cy . get ( '#selected-licenses' ) . children ( ) . should ( 'have.length' , 0 ) ;
2224 } ) ;
2325
2426 it ( 'can add a license by typing' , function ( ) {
@@ -28,8 +30,8 @@ describe('License input field', function () {
2830 } ) ;
2931
3032 it ( 'can add a license by typing non-strictly with spaces' , function ( ) {
31- // " MIT " -> "MIT"
32- cy . get ( '#license' ) . type ( ' MIT{enter}' ) ;
33+ // " MIT " -> "MIT"
34+ cy . get ( '#license' ) . type ( ' MIT {enter}' ) ;
3335 cy . get ( '#selected-licenses .license-id' ) . should ( 'contain' , 'MIT' ) ;
3436 cy . get ( '#license' ) . should ( 'have.value' , '' ) ;
3537 } ) ;
@@ -48,8 +50,7 @@ describe('License input field', function () {
4850 // mouse or when autocompletion replaces the current text)
4951 cy . get ( '#license' )
5052 . invoke ( 'val' , 'MIT' )
51- . trigger ( 'input' , { inputType : 'insertReplacementText' } )
52- . trigger ( 'change' ) ;
53+ . trigger ( 'input' , { inputType : 'insertReplacementText' } ) ;
5354 cy . get ( '#selected-licenses .license-id' , { timeout : 5000 } )
5455 . should ( 'contain' , 'MIT' ) ;
5556 cy . get ( '#license' ) . should ( 'have.value' , '' ) ;
0 commit comments