@@ -10,7 +10,16 @@ const defaultSettings: PaddingSettings = {
1010 fillImageDataUrl : null ,
1111 fillImageStyle : 'cover' ,
1212 aspectRatio : 'auto' ,
13+ customRatioWidth : 4 ,
14+ customRatioHeight : 3 ,
1315 borderPadding : 0 ,
16+ outputFormat : 'png' ,
17+ outputQuality : 0.92 ,
18+ maxDimension : 0 ,
19+ gradientDirection : 'vertical' ,
20+ gradientColorStart : '#ffffff' ,
21+ gradientColorEnd : '#000000' ,
22+ blurAmount : 40 ,
1423} ;
1524
1625function renderPanel ( overrides : Partial < Parameters < typeof PaddingSettingsPanel > [ 0 ] > = { } ) {
@@ -27,34 +36,39 @@ function renderPanel(overrides: Partial<Parameters<typeof PaddingSettingsPanel>[
2736}
2837
2938describe ( 'PaddingSettingsPanel' , ( ) => {
30- it ( 'renders with default settings (Solid Color selected)' , ( ) => {
39+ it ( 'renders with default settings (Color fill selected)' , ( ) => {
3140 renderPanel ( ) ;
32- expect ( screen . getByText ( 'Solid Color' ) ) . toBeInTheDocument ( ) ;
33- expect ( screen . getByText ( 'Background Image' ) ) . toBeInTheDocument ( ) ;
34- expect ( screen . getByText ( 'Color' ) ) . toBeInTheDocument ( ) ;
41+ expect ( screen . getByText ( 'Padding Settings' ) ) . toBeInTheDocument ( ) ;
42+ // Fill type buttons
43+ const colorBtn = screen . getAllByText ( 'Color' ) [ 0 ] ;
44+ expect ( colorBtn ) . toBeInTheDocument ( ) ;
45+ expect ( screen . getByText ( 'Gradient' ) ) . toBeInTheDocument ( ) ;
46+ expect ( screen . getByText ( 'Blur' ) ) . toBeInTheDocument ( ) ;
3547 } ) ;
3648
37- it ( 'switches to Background Image fill type' , async ( ) => {
49+ it ( 'switches to Image fill type' , async ( ) => {
3850 const user = userEvent . setup ( ) ;
3951 const { onChange } = renderPanel ( ) ;
4052
41- await user . click ( screen . getByText ( 'Background Image' ) ) ;
53+ // The fill type buttons are in the grid - "Image" is the second one
54+ const fillButtons = screen . getAllByText ( 'Image' ) ;
55+ await user . click ( fillButtons [ 0 ] ) ;
4256 expect ( onChange ) . toHaveBeenCalledWith ( expect . objectContaining ( { fillType : 'image' } ) ) ;
4357 } ) ;
4458
45- it ( 'switches to Solid Color fill type' , async ( ) => {
59+ it ( 'switches to Color fill type from image ' , async ( ) => {
4660 const user = userEvent . setup ( ) ;
4761 const { onChange } = renderPanel ( {
4862 settings : { ...defaultSettings , fillType : 'image' } ,
4963 } ) ;
5064
51- await user . click ( screen . getByText ( 'Solid Color' ) ) ;
65+ const colorButtons = screen . getAllByText ( 'Color' ) ;
66+ await user . click ( colorButtons [ 0 ] ) ;
5267 expect ( onChange ) . toHaveBeenCalledWith ( expect . objectContaining ( { fillType : 'color' } ) ) ;
5368 } ) ;
5469
5570 it ( 'shows color picker when fillType is color' , ( ) => {
5671 renderPanel ( ) ;
57- expect ( screen . getByText ( 'Color' ) ) . toBeInTheDocument ( ) ;
5872 const colorInput = document . querySelector ( 'input[type="color"]' ) ;
5973 expect ( colorInput ) . toBeInTheDocument ( ) ;
6074 } ) ;
@@ -64,7 +78,29 @@ describe('PaddingSettingsPanel', () => {
6478 settings : { ...defaultSettings , fillType : 'image' } ,
6579 } ) ;
6680 expect ( screen . getByText ( 'Upload image' ) ) . toBeInTheDocument ( ) ;
67- expect ( screen . getByText ( 'Image' ) ) . toBeInTheDocument ( ) ;
81+ } ) ;
82+
83+ it ( 'shows gradient controls when fillType is gradient' , ( ) => {
84+ renderPanel ( {
85+ settings : { ...defaultSettings , fillType : 'gradient' } ,
86+ } ) ;
87+ expect ( screen . getByText ( 'Direction' ) ) . toBeInTheDocument ( ) ;
88+ expect ( screen . getByText ( 'Start' ) ) . toBeInTheDocument ( ) ;
89+ expect ( screen . getByText ( 'End' ) ) . toBeInTheDocument ( ) ;
90+ } ) ;
91+
92+ it ( 'shows blur controls when fillType is blur' , ( ) => {
93+ renderPanel ( {
94+ settings : { ...defaultSettings , fillType : 'blur' } ,
95+ } ) ;
96+ expect ( screen . getByText ( 'Blur Amount' ) ) . toBeInTheDocument ( ) ;
97+ } ) ;
98+
99+ it ( 'shows output format selector' , ( ) => {
100+ renderPanel ( ) ;
101+ expect ( screen . getByText ( 'png' ) ) . toBeInTheDocument ( ) ;
102+ expect ( screen . getByText ( 'jpeg' ) ) . toBeInTheDocument ( ) ;
103+ expect ( screen . getByText ( 'webp' ) ) . toBeInTheDocument ( ) ;
68104 } ) ;
69105
70106 it ( 'process button is disabled when hasPhotos is false' , ( ) => {
0 commit comments