@@ -1886,41 +1886,42 @@ describe('ReactHooksWithNoopRenderer', () => {
1886
1886
// This reducer closes over a value from props. If the reducer is not
1887
1887
// properly updated, the eager reducer will compare to an old value
1888
1888
// and bail out incorrectly.
1889
- Scheduler . yieldValue ( 'Reducer: ' + count ) ;
1889
+ ReactNoop . yield ( 'Reducer: ' + count ) ;
1890
1890
return count ;
1891
1891
} , - 1 ) ;
1892
1892
useEffect (
1893
1893
( ) => {
1894
- Scheduler . yieldValue ( 'Effect: ' + count ) ;
1894
+ ReactNoop . yield ( 'Effect: ' + count ) ;
1895
1895
dispatch ( ) ;
1896
1896
} ,
1897
1897
[ count ] ,
1898
1898
) ;
1899
- Scheduler . yieldValue ( 'Render: ' + state ) ;
1900
- return count ;
1899
+ ReactNoop . yield ( 'Render: ' + state ) ;
1900
+ return < span prop = { count } /> ;
1901
1901
}
1902
1902
1903
1903
ReactNoop . render ( < App /> ) ;
1904
- expect ( Scheduler ) . toFlushAndYield ( [
1905
- 'Render: -1' ,
1904
+ expect ( ReactNoop . flush ( ) ) . toEqual ( [ 'Render: -1' ] ) ;
1905
+ ReactNoop . flushPassiveEffects ( ) ;
1906
+ expect ( ReactNoop . flush ( ) ) . toEqual ( [
1906
1907
'Effect: 1' ,
1907
1908
'Reducer: 1' ,
1908
1909
'Reducer: 1' ,
1909
1910
'Render: 1' ,
1910
1911
] ) ;
1911
- expect ( ReactNoop ) . toMatchRenderedOutput ( '1' ) ;
1912
+ expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 1 ) ] ) ;
1912
1913
1913
1914
act ( ( ) => {
1914
1915
setCounter ( 2 ) ;
1915
1916
} ) ;
1916
- expect ( Scheduler ) . toFlushAndYield ( [
1917
+ expect ( ReactNoop . flush ( ) ) . toEqual ( [
1917
1918
'Render: 1' ,
1918
1919
'Effect: 2' ,
1919
1920
'Reducer: 2' ,
1920
1921
'Reducer: 2' ,
1921
1922
'Render: 2' ,
1922
1923
] ) ;
1923
- expect ( ReactNoop ) . toMatchRenderedOutput ( '2' ) ;
1924
+ expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 2 ) ] ) ;
1924
1925
} ) ;
1925
1926
1926
1927
it ( 'should update latest rendered reducer when a preceding state receives a render phase update' , ( ) => {
@@ -1936,23 +1937,23 @@ describe('ReactHooksWithNoopRenderer', () => {
1936
1937
setStep ( step + 1 ) ;
1937
1938
}
1938
1939
1939
- Scheduler . yieldValue ( `Step: ${ step } , Shadow: ${ shadow } ` ) ;
1940
- return shadow ;
1940
+ ReactNoop . yield ( `Step: ${ step } , Shadow: ${ shadow } ` ) ;
1941
+ return < span prop = { shadow } /> ;
1941
1942
}
1942
1943
1943
1944
ReactNoop . render ( < App /> ) ;
1944
- expect ( Scheduler ) . toFlushAndYield ( [
1945
+ expect ( ReactNoop . flush ( ) ) . toEqual ( [
1945
1946
'Step: 0, Shadow: 0' ,
1946
1947
'Step: 1, Shadow: 0' ,
1947
1948
'Step: 2, Shadow: 0' ,
1948
1949
'Step: 3, Shadow: 0' ,
1949
1950
'Step: 4, Shadow: 0' ,
1950
1951
'Step: 5, Shadow: 0' ,
1951
1952
] ) ;
1952
- expect ( ReactNoop ) . toMatchRenderedOutput ( '0' ) ;
1953
+ expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 0 ) ] ) ;
1953
1954
1954
1955
act ( ( ) => dispatch ( ) ) ;
1955
- expect ( Scheduler ) . toFlushAndYield ( [ 'Step: 5, Shadow: 5' ] ) ;
1956
- expect ( ReactNoop ) . toMatchRenderedOutput ( '5' ) ;
1956
+ expect ( ReactNoop . flush ( ) ) . toEqual ( [ 'Step: 5, Shadow: 5' ] ) ;
1957
+ expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 5 ) ] ) ;
1957
1958
} ) ;
1958
1959
} ) ;
0 commit comments