@@ -97,41 +97,51 @@ describe('CreatePriceAlertView', () => {
9797 ) . toBeOnTheScreen ( ) ;
9898 } ) ;
9999
100- it ( 'shows percentage pickers and hides Set button before any input' , ( ) => {
101- const { getByTestId, queryByTestId } = renderWithToast ( ) ;
100+ it ( 'shows percentage pickers and Set button before any input' , ( ) => {
101+ const { getByTestId } = renderWithToast ( ) ;
102102
103103 expect (
104104 getByTestId ( `${ CreatePriceAlertTestIds . QUICK_PERCENTAGE_PREFIX } -5` ) ,
105105 ) . toBeOnTheScreen ( ) ;
106- expect ( queryByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ) . toBeNull ( ) ;
106+ expect (
107+ getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
108+ ) . toBeOnTheScreen ( ) ;
109+ expect (
110+ getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
111+ ) . toBeDisabled ( ) ;
107112 } ) ;
108113
109- it ( 'hides percentage pickers and shows Set button once user types a digit' , ( ) => {
110- const { getByTestId, queryByTestId } = renderWithToast ( ) ;
114+ it ( 'keeps percentage pickers visible and enables Set button once user types a digit' , ( ) => {
115+ const { getByTestId } = renderWithToast ( ) ;
111116
112117 fireEvent . press ( getByTestId ( 'keypad-key-1' ) ) ;
113118
114119 expect (
115- queryByTestId ( `${ CreatePriceAlertTestIds . QUICK_PERCENTAGE_PREFIX } -5` ) ,
116- ) . toBeNull ( ) ;
120+ getByTestId ( `${ CreatePriceAlertTestIds . QUICK_PERCENTAGE_PREFIX } -5` ) ,
121+ ) . toBeOnTheScreen ( ) ;
117122 expect (
118123 getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
119124 ) . toBeOnTheScreen ( ) ;
125+ expect (
126+ getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
127+ ) . not . toBeDisabled ( ) ;
120128 } ) ;
121129
122- it ( 'keeps percentage pickers and hides Set button for zero-valued keypad input like "0."' , ( ) => {
123- const { getByTestId, getByText, queryByTestId } = renderWithToast ( ) ;
130+ it ( 'keeps percentage pickers visible and Set button disabled for zero-valued keypad input like "0."' , ( ) => {
131+ const { getByTestId, getByText } = renderWithToast ( ) ;
124132
125133 fireEvent . press ( getByTestId ( 'keypad-key-dot' ) ) ;
126134
127135 expect ( getByText ( '$0.' ) ) . toBeOnTheScreen ( ) ;
128136 expect (
129137 getByTestId ( `${ CreatePriceAlertTestIds . QUICK_PERCENTAGE_PREFIX } -5` ) ,
130138 ) . toBeOnTheScreen ( ) ;
131- expect ( queryByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ) . toBeNull ( ) ;
139+ expect (
140+ getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
141+ ) . toBeDisabled ( ) ;
132142 } ) ;
133143
134- it ( 'shows Set button after a quick-percentage pill is pressed' , ( ) => {
144+ it ( 'enables Set button after a quick-percentage pill is pressed' , ( ) => {
135145 const { getByTestId } = renderWithToast ( ) ;
136146
137147 fireEvent . press (
@@ -141,6 +151,9 @@ describe('CreatePriceAlertView', () => {
141151 expect (
142152 getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
143153 ) . toBeOnTheScreen ( ) ;
154+ expect (
155+ getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
156+ ) . not . toBeDisabled ( ) ;
144157 } ) ;
145158
146159 it ( 'shows under development message when price change is selected' , ( ) => {
@@ -190,7 +203,9 @@ describe('CreatePriceAlertView', () => {
190203 getByTestId ( `${ CreatePriceAlertTestIds . QUICK_PERCENTAGE_PREFIX } -5` ) ,
191204 ) ;
192205
193- expect ( getByText ( '5%' ) ) . toBeOnTheScreen ( ) ;
206+ expect ( getByTestId ( CreatePriceAlertTestIds . PERCENT_DIFF ) ) . toHaveTextContent (
207+ / 5 % / ,
208+ ) ;
194209 expect ( getByText ( / a b o v e c u r r e n t E T H p r i c e / ) ) . toBeOnTheScreen ( ) ;
195210 } ) ;
196211
@@ -413,7 +428,7 @@ describe('CreatePriceAlertView — tiny price token', () => {
413428 expect ( getByText ( '$0.000000000000011' ) ) . toBeOnTheScreen ( ) ;
414429 } ) ;
415430
416- it ( 'quick-percentage pill produces a non-zero value and reveals the Set button' , ( ) => {
431+ it ( 'quick-percentage pill produces a non-zero value and enables the Set button' , ( ) => {
417432 const { getByTestId } = render ( < CreatePriceAlertView /> ) ;
418433
419434 fireEvent . press (
@@ -423,6 +438,9 @@ describe('CreatePriceAlertView — tiny price token', () => {
423438 expect (
424439 getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
425440 ) . toBeOnTheScreen ( ) ;
441+ expect (
442+ getByTestId ( CreatePriceAlertTestIds . SET_ALERT_BUTTON ) ,
443+ ) . not . toBeDisabled ( ) ;
426444 } ) ;
427445
428446 it ( 'allows manual keypad entry beyond two decimal places for sub-cent tokens' , ( ) => {
0 commit comments