File tree Expand file tree Collapse file tree 5 files changed +29
-1
lines changed
content/highlights/components Expand file tree Collapse file tree 5 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,26 @@ describe('EditCard', () => {
106106 mockSpyUser . mockClear ( ) ;
107107 } ) ;
108108
109+ it ( 'shows create highlight message for new highlight' , ( ) => {
110+ const newHighlight = { ...highlight , elements : [ ] } ;
111+ const mockSpyUser = jest . spyOn ( selectAuth , 'user' )
112+ . mockReturnValue ( formatUser ( testAccountsUser ) ) ;
113+ const component = renderer . create (
114+ < TestContainer services = { services } store = { store } >
115+ < EditCard
116+ { ...{ ...editCardProps , highlight : newHighlight } }
117+ data = { highlightData }
118+ isActive = { true }
119+ shouldFocusCard = { false }
120+ />
121+ </ TestContainer >
122+ ) ;
123+
124+ const button = component . root . findByType ( 'button' ) ;
125+ expect ( button . props . children . props . id ) . toBe ( 'i18n:highlighting:create-instructions' ) ;
126+ mockSpyUser . mockClear ( ) ;
127+ } ) ;
128+
109129 it ( 'matches snapshot without data' , ( ) => {
110130 const component = renderer . create (
111131 < TestContainer services = { services } store = { store } >
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ function LoginOrEdit({
7474 document ?. dispatchEvent ( new CustomEvent ( 'showCardEvent' , { bubbles : true } ) ) ;
7575 }
7676 } , [ ] ) ;
77+ const isNewSelection = props . highlight . elements . length === 0 ;
7778
7879 return (
7980 < div
@@ -95,7 +96,11 @@ function LoginOrEdit({
9596 </ form >
9697 ) :
9798 < button type = 'button' onMouseDown = { showCard } >
98- < FormattedMessage id = 'i18n:highlighting:instructions' />
99+ < FormattedMessage id = {
100+ isNewSelection
101+ ? 'i18n:highlighting:create-instructions'
102+ : 'i18n:highlighting:instructions'
103+ } />
99104 </ button >
100105 }
101106 </ HiddenOnMobile >
Original file line number Diff line number Diff line change 7272 "i18n:highlighter:highlight:end:search" : " End of search result" ,
7373 "i18n:highlighter:highlight:start:search" : " Start search result" ,
7474 "i18n:highlighter:highlight:start-selected:search" : " Start selected search result" ,
75+ "i18n:highlighting:create-instructions" : " Press Enter or click here to create highlight" ,
7576 "i18n:highlighting:instructions" : " Press Enter or click here to edit highlight" ,
7677 "i18n:highlighting:button:cancel" : " Cancel" ,
7778 "i18n:highlighting:button:delete" : " Delete" ,
Original file line number Diff line number Diff line change 6969 "i18n:highlighter:highlight:end:search" : " Final de resultado de búsqueda" ,
7070 "i18n:highlighter:highlight:start:search" : " Comienzo de resultado de búsqueda" ,
7171 "i18n:highlighter:highlight:start-selected:search" : " Comienzo de resultado de búsqueda seleccionado" ,
72+ "i18n:highlighting:create-instructions" : " Presione Enter o haga clic aquí para crear lo resaltado" ,
7273 "i18n:highlighting:instructions" : " Presione Enter o haga clic aquí para editar lo resaltado" ,
7374 "i18n:highlighting:button:cancel" : " Cancelar" ,
7475 "i18n:highlighting:button:delete" : " Eliminar" ,
Original file line number Diff line number Diff line change 6969 "i18n:highlighter:highlight:end:search" : " Koniec zakreślenia wyniku wyszukiwania" ,
7070 "i18n:highlighter:highlight:start:search" : " Początek zakreślenia wyniku wyszukiwania" ,
7171 "i18n:highlighter:highlight:start-selected:search" : " Początek wybranego wyniku wyszukiwania" ,
72+ "i18n:highlighting:create-instructions" : " Naciśnij Enter lub kliknij tutaj, aby utworzyć wyróżnienie." ,
7273 "i18n:highlighting:instructions" : " Naciśnij Enter lub kliknij tutaj, aby edytować wyróżnienie" ,
7374 "i18n:highlighting:button:cancel" : " Anuluj" ,
7475 "i18n:highlighting:button:delete" : " Usuń" ,
You can’t perform that action at this time.
0 commit comments