mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +00:00 
			
		
		
		
	Add tests
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
		
							parent
							
								
									912187b078
								
							
						
					
					
						commit
						a726a63900
					
				| @ -495,21 +495,6 @@ describe('ADMIN | PAGES | AUTH | BaseLogin', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c3 { | ||||
|         margin: 0 auto; | ||||
|         width: 552px; | ||||
|       } | ||||
| 
 | ||||
|       .c5 { | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c6 { | ||||
|         height: 4.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c22 { | ||||
|         border: none; | ||||
|         background: transparent; | ||||
| @ -526,6 +511,21 @@ describe('ADMIN | PAGES | AUTH | BaseLogin', () => { | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c3 { | ||||
|         margin: 0 auto; | ||||
|         width: 552px; | ||||
|       } | ||||
| 
 | ||||
|       .c5 { | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c6 { | ||||
|         height: 4.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c23 svg { | ||||
|         height: 1rem; | ||||
|         width: 1rem; | ||||
|  | ||||
| @ -512,21 +512,6 @@ describe('ADMIN | PAGES | AUTH | Register', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c10 { | ||||
|         margin: 0 auto; | ||||
|         width: 552px; | ||||
|       } | ||||
| 
 | ||||
|       .c13 { | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         height: 4.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c32 { | ||||
|         border: none; | ||||
|         background: transparent; | ||||
| @ -543,6 +528,21 @@ describe('ADMIN | PAGES | AUTH | Register', () => { | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c10 { | ||||
|         margin: 0 auto; | ||||
|         width: 552px; | ||||
|       } | ||||
| 
 | ||||
|       .c13 { | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         height: 4.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c33 svg { | ||||
|         height: 1rem; | ||||
|         width: 1rem; | ||||
|  | ||||
| @ -413,21 +413,6 @@ describe('ADMIN | PAGES | AUTH | ResetPassword', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c11 { | ||||
|         margin: 0 auto; | ||||
|         width: 552px; | ||||
|       } | ||||
| 
 | ||||
|       .c13 { | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         height: 4.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c25 { | ||||
|         border: none; | ||||
|         background: transparent; | ||||
| @ -444,6 +429,21 @@ describe('ADMIN | PAGES | AUTH | ResetPassword', () => { | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c11 { | ||||
|         margin: 0 auto; | ||||
|         width: 552px; | ||||
|       } | ||||
| 
 | ||||
|       .c13 { | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         height: 4.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c26 svg { | ||||
|         height: 1rem; | ||||
|         width: 1rem; | ||||
|  | ||||
| @ -36,6 +36,29 @@ describe('Homepage', () => { | ||||
|     } = render(App); | ||||
| 
 | ||||
|     expect(firstChild).toMatchInlineSnapshot(` | ||||
|       .c5 { | ||||
|         padding: 56px; | ||||
|       } | ||||
| 
 | ||||
|       .c8 { | ||||
|         padding-bottom: 56px; | ||||
|         padding-left: 24px; | ||||
|       } | ||||
| 
 | ||||
|       .c34 { | ||||
|         background: #ffffff; | ||||
|         padding-top: 24px; | ||||
|         padding-right: 20px; | ||||
|         padding-bottom: 24px; | ||||
|         padding-left: 20px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c35 { | ||||
|         padding-bottom: 32px; | ||||
|       } | ||||
| 
 | ||||
|       .c18 { | ||||
|         font-weight: 400; | ||||
|         font-size: 0.875rem; | ||||
| @ -300,29 +323,6 @@ describe('Homepage', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c5 { | ||||
|         padding: 56px; | ||||
|       } | ||||
| 
 | ||||
|       .c8 { | ||||
|         padding-bottom: 56px; | ||||
|         padding-left: 24px; | ||||
|       } | ||||
| 
 | ||||
|       .c34 { | ||||
|         background: #ffffff; | ||||
|         padding-top: 24px; | ||||
|         padding-right: 20px; | ||||
|         padding-bottom: 24px; | ||||
|         padding-left: 20px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c35 { | ||||
|         padding-bottom: 32px; | ||||
|       } | ||||
| 
 | ||||
|       .c6 { | ||||
|         display: grid; | ||||
|         grid-template-columns: repeat(12,1fr); | ||||
|  | ||||
| @ -61,6 +61,16 @@ describe('ADMIN | Pages | Profile page', () => { | ||||
|     }); | ||||
| 
 | ||||
|     expect(container.firstChild).toMatchInlineSnapshot(` | ||||
|       .c15 { | ||||
|         background: #ffffff; | ||||
|         padding-top: 24px; | ||||
|         padding-right: 32px; | ||||
|         padding-bottom: 24px; | ||||
|         padding-left: 32px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c10 { | ||||
|         font-weight: 500; | ||||
|         font-size: 0.75rem; | ||||
| @ -159,6 +169,148 @@ describe('ADMIN | Pages | Profile page', () => { | ||||
|         background: #4945ff; | ||||
|       } | ||||
| 
 | ||||
|       .c30 { | ||||
|         position: absolute; | ||||
|         left: 0; | ||||
|         right: 0; | ||||
|         bottom: 0; | ||||
|         top: 0; | ||||
|         width: 100%; | ||||
|         background: transparent; | ||||
|         border: none; | ||||
|       } | ||||
| 
 | ||||
|       .c30:focus { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c28 { | ||||
|         font-weight: 500; | ||||
|         font-size: 0.75rem; | ||||
|         line-height: 1.33; | ||||
|         color: #32324d; | ||||
|       } | ||||
| 
 | ||||
|       .c35 { | ||||
|         font-weight: 400; | ||||
|         font-size: 0.875rem; | ||||
|         line-height: 1.43; | ||||
|         color: #32324d; | ||||
|       } | ||||
| 
 | ||||
|       .c39 { | ||||
|         font-weight: 400; | ||||
|         font-size: 0.75rem; | ||||
|         line-height: 1.33; | ||||
|         color: #666687; | ||||
|       } | ||||
| 
 | ||||
|       .c34 { | ||||
|         padding-right: 16px; | ||||
|         padding-left: 16px; | ||||
|       } | ||||
| 
 | ||||
|       .c37 { | ||||
|         padding-left: 12px; | ||||
|       } | ||||
| 
 | ||||
|       .c31 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         -webkit-flex-direction: row; | ||||
|         -ms-flex-direction: row; | ||||
|         flex-direction: row; | ||||
|         -webkit-box-pack: justify; | ||||
|         -webkit-justify-content: space-between; | ||||
|         -ms-flex-pack: justify; | ||||
|         justify-content: space-between; | ||||
|         -webkit-align-items: center; | ||||
|         -webkit-box-align: center; | ||||
|         -ms-flex-align: center; | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c33 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         -webkit-flex-direction: row; | ||||
|         -ms-flex-direction: row; | ||||
|         flex-direction: row; | ||||
|         -webkit-align-items: center; | ||||
|         -webkit-box-align: center; | ||||
|         -ms-flex-align: center; | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c27 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c27 > * { | ||||
|         margin-top: 0; | ||||
|         margin-bottom: 0; | ||||
|       } | ||||
| 
 | ||||
|       .c27 > * + * { | ||||
|         margin-top: 4px; | ||||
|       } | ||||
| 
 | ||||
|       .c29 { | ||||
|         position: relative; | ||||
|         border: 1px solid #dcdce4; | ||||
|         padding-right: 12px; | ||||
|         border-radius: 4px; | ||||
|         background: #ffffff; | ||||
|         overflow: hidden; | ||||
|       } | ||||
| 
 | ||||
|       .c29:focus-within { | ||||
|         border: 1px solid #4945ff; | ||||
|       } | ||||
| 
 | ||||
|       .c36 { | ||||
|         background: transparent; | ||||
|         border: none; | ||||
|         position: relative; | ||||
|         z-index: 1; | ||||
|       } | ||||
| 
 | ||||
|       .c36 svg { | ||||
|         height: 0.6875rem; | ||||
|         width: 0.6875rem; | ||||
|       } | ||||
| 
 | ||||
|       .c36 svg path { | ||||
|         fill: #666687; | ||||
|       } | ||||
| 
 | ||||
|       .c38 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         background: none; | ||||
|         border: none; | ||||
|       } | ||||
| 
 | ||||
|       .c38 svg { | ||||
|         width: 0.375rem; | ||||
|       } | ||||
| 
 | ||||
|       .c32 { | ||||
|         min-height: 2.5rem; | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
| @ -314,16 +466,6 @@ describe('ADMIN | Pages | Profile page', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c15 { | ||||
|         background: #ffffff; | ||||
|         padding-top: 24px; | ||||
|         padding-right: 32px; | ||||
|         padding-bottom: 24px; | ||||
|         padding-left: 32px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c1 { | ||||
|         background: #f6f6f9; | ||||
|         padding-top: 56px; | ||||
| @ -399,148 +541,6 @@ describe('ADMIN | Pages | Profile page', () => { | ||||
|         word-break: break-all; | ||||
|       } | ||||
| 
 | ||||
|       .c30 { | ||||
|         position: absolute; | ||||
|         left: 0; | ||||
|         right: 0; | ||||
|         bottom: 0; | ||||
|         top: 0; | ||||
|         width: 100%; | ||||
|         background: transparent; | ||||
|         border: none; | ||||
|       } | ||||
| 
 | ||||
|       .c30:focus { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c28 { | ||||
|         font-weight: 500; | ||||
|         font-size: 0.75rem; | ||||
|         line-height: 1.33; | ||||
|         color: #32324d; | ||||
|       } | ||||
| 
 | ||||
|       .c35 { | ||||
|         font-weight: 400; | ||||
|         font-size: 0.875rem; | ||||
|         line-height: 1.43; | ||||
|         color: #32324d; | ||||
|       } | ||||
| 
 | ||||
|       .c39 { | ||||
|         font-weight: 400; | ||||
|         font-size: 0.75rem; | ||||
|         line-height: 1.33; | ||||
|         color: #666687; | ||||
|       } | ||||
| 
 | ||||
|       .c34 { | ||||
|         padding-right: 16px; | ||||
|         padding-left: 16px; | ||||
|       } | ||||
| 
 | ||||
|       .c37 { | ||||
|         padding-left: 12px; | ||||
|       } | ||||
| 
 | ||||
|       .c31 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         -webkit-flex-direction: row; | ||||
|         -ms-flex-direction: row; | ||||
|         flex-direction: row; | ||||
|         -webkit-box-pack: justify; | ||||
|         -webkit-justify-content: space-between; | ||||
|         -ms-flex-pack: justify; | ||||
|         justify-content: space-between; | ||||
|         -webkit-align-items: center; | ||||
|         -webkit-box-align: center; | ||||
|         -ms-flex-align: center; | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c33 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         -webkit-flex-direction: row; | ||||
|         -ms-flex-direction: row; | ||||
|         flex-direction: row; | ||||
|         -webkit-align-items: center; | ||||
|         -webkit-box-align: center; | ||||
|         -ms-flex-align: center; | ||||
|         align-items: center; | ||||
|       } | ||||
| 
 | ||||
|       .c27 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         -webkit-flex-direction: column; | ||||
|         -ms-flex-direction: column; | ||||
|         flex-direction: column; | ||||
|       } | ||||
| 
 | ||||
|       .c27 > * { | ||||
|         margin-top: 0; | ||||
|         margin-bottom: 0; | ||||
|       } | ||||
| 
 | ||||
|       .c27 > * + * { | ||||
|         margin-top: 4px; | ||||
|       } | ||||
| 
 | ||||
|       .c29 { | ||||
|         position: relative; | ||||
|         border: 1px solid #dcdce4; | ||||
|         padding-right: 12px; | ||||
|         border-radius: 4px; | ||||
|         background: #ffffff; | ||||
|         overflow: hidden; | ||||
|       } | ||||
| 
 | ||||
|       .c29:focus-within { | ||||
|         border: 1px solid #4945ff; | ||||
|       } | ||||
| 
 | ||||
|       .c36 { | ||||
|         background: transparent; | ||||
|         border: none; | ||||
|         position: relative; | ||||
|         z-index: 1; | ||||
|       } | ||||
| 
 | ||||
|       .c36 svg { | ||||
|         height: 0.6875rem; | ||||
|         width: 0.6875rem; | ||||
|       } | ||||
| 
 | ||||
|       .c36 svg path { | ||||
|         fill: #666687; | ||||
|       } | ||||
| 
 | ||||
|       .c38 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
|         display: -ms-flexbox; | ||||
|         display: flex; | ||||
|         background: none; | ||||
|         border: none; | ||||
|       } | ||||
| 
 | ||||
|       .c38 svg { | ||||
|         width: 0.375rem; | ||||
|       } | ||||
| 
 | ||||
|       .c32 { | ||||
|         min-height: 2.5rem; | ||||
|       } | ||||
| 
 | ||||
|       @media (max-width:68.75rem) { | ||||
|         .c19 { | ||||
|           grid-column: span; | ||||
|  | ||||
| @ -32,6 +32,20 @@ describe('Application page', () => { | ||||
|     } = render(App); | ||||
| 
 | ||||
|     expect(firstChild).toMatchInlineSnapshot(` | ||||
|       .c11 { | ||||
|         background: #ffffff; | ||||
|         padding-top: 32px; | ||||
|         padding-right: 24px; | ||||
|         padding-bottom: 32px; | ||||
|         padding-left: 24px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c26 { | ||||
|         padding-top: 4px; | ||||
|       } | ||||
| 
 | ||||
|       .c12 { | ||||
|         display: -webkit-box; | ||||
|         display: -webkit-flex; | ||||
| @ -158,20 +172,6 @@ describe('Application page', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c11 { | ||||
|         background: #ffffff; | ||||
|         padding-top: 32px; | ||||
|         padding-right: 24px; | ||||
|         padding-bottom: 32px; | ||||
|         padding-left: 24px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c26 { | ||||
|         padding-top: 4px; | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         padding-top: 4px; | ||||
|       } | ||||
|  | ||||
| @ -49,6 +49,13 @@ describe('Admin | containers | ListView', () => { | ||||
|     } = render(App); | ||||
| 
 | ||||
|     expect(firstChild).toMatchInlineSnapshot(` | ||||
|       .c11 { | ||||
|         background: #ffffff; | ||||
|         padding: 24px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       .c14 { | ||||
|         border: 0; | ||||
|         -webkit-clip: rect(0 0 0 0); | ||||
| @ -169,13 +176,6 @@ describe('Admin | containers | ListView', () => { | ||||
|         outline: none; | ||||
|       } | ||||
| 
 | ||||
|       .c11 { | ||||
|         background: #ffffff; | ||||
|         padding: 24px; | ||||
|         border-radius: 4px; | ||||
|         box-shadow: 0px 1px 4px rgba(33,33,52,0.1); | ||||
|       } | ||||
| 
 | ||||
|       <div | ||||
|         class="c0" | ||||
|       > | ||||
|  | ||||
| @ -0,0 +1,383 @@ | ||||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||||
| 
 | ||||
| exports[`<FilterListURLQuery /> renders and matches the snapshot 1`] = ` | ||||
| .c7 { | ||||
|   border: 0; | ||||
|   -webkit-clip: rect(0 0 0 0); | ||||
|   clip: rect(0 0 0 0); | ||||
|   height: 1px; | ||||
|   margin: -1px; | ||||
|   overflow: hidden; | ||||
|   padding: 0; | ||||
|   position: absolute; | ||||
|   width: 1px; | ||||
| } | ||||
| 
 | ||||
| .c0 { | ||||
|   padding: 4px; | ||||
| } | ||||
| 
 | ||||
| .c4 { | ||||
|   font-weight: 500; | ||||
|   font-size: 0.75rem; | ||||
|   line-height: 1.33; | ||||
|   color: #32324d; | ||||
| } | ||||
| 
 | ||||
| .c1 { | ||||
|   background: #f0f0ff; | ||||
|   color: #4945ff; | ||||
|   padding-right: 12px; | ||||
|   padding-left: 12px; | ||||
| } | ||||
| 
 | ||||
| .c6 { | ||||
|   padding-left: 8px; | ||||
| } | ||||
| 
 | ||||
| .c3 { | ||||
|   display: -webkit-box; | ||||
|   display: -webkit-flex; | ||||
|   display: -ms-flexbox; | ||||
|   display: flex; | ||||
|   -webkit-flex-direction: row; | ||||
|   -ms-flex-direction: row; | ||||
|   flex-direction: row; | ||||
|   -webkit-align-items: center; | ||||
|   -webkit-box-align: center; | ||||
|   -ms-flex-align: center; | ||||
|   align-items: center; | ||||
| } | ||||
| 
 | ||||
| .c2 { | ||||
|   border: 1px solid #d9d8ff; | ||||
|   border-radius: 4px; | ||||
|   height: 2rem; | ||||
| } | ||||
| 
 | ||||
| .c2 svg { | ||||
|   height: 0.5rem; | ||||
|   width: 0.5rem; | ||||
| } | ||||
| 
 | ||||
| .c2 svg path { | ||||
|   fill: #4945ff; | ||||
| } | ||||
| 
 | ||||
| .c5 { | ||||
|   border-right: 1px solid #d9d8ff; | ||||
|   padding-right: 8px; | ||||
| } | ||||
| 
 | ||||
| <div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           bool | ||||
|             | ||||
|           is | ||||
|             | ||||
|           true | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           date | ||||
|             | ||||
|           is | ||||
|             | ||||
|           Wednesday, September 1, 2021 | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           enum | ||||
|             | ||||
|           is | ||||
|             | ||||
|           one | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           long | ||||
|             | ||||
|           is | ||||
|             | ||||
|           test | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           many_to_one | ||||
|             | ||||
|           is | ||||
|             | ||||
|           test | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           number | ||||
|             | ||||
|           is | ||||
|             | ||||
|           2 | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c0" | ||||
|   > | ||||
|     <button | ||||
|       class="c1 c2" | ||||
|     > | ||||
|       <div | ||||
|         class="c3" | ||||
|       > | ||||
|         <span | ||||
|           class="c4 c5" | ||||
|         > | ||||
|           time | ||||
|             | ||||
|           contains | ||||
|             | ||||
|           12:45 AM | ||||
|         </span> | ||||
|         <div | ||||
|           class="c6" | ||||
|         > | ||||
|           <div | ||||
|             class="c3" | ||||
|           > | ||||
|             <svg | ||||
|               fill="none" | ||||
|               height="1em" | ||||
|               viewBox="0 0 24 24" | ||||
|               width="1em" | ||||
|               xmlns="http://www.w3.org/2000/svg" | ||||
|             > | ||||
|               <path | ||||
|                 d="M24 2.417L21.583 0 12 9.583 2.417 0 0 2.417 9.583 12 0 21.583 2.417 24 12 14.417 21.583 24 24 21.583 14.417 12 24 2.417z" | ||||
|                 fill="#32324D" | ||||
|               /> | ||||
|             </svg> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </button> | ||||
|   </div> | ||||
|   <div | ||||
|     class="c7" | ||||
|   > | ||||
|     <p | ||||
|       aria-live="polite" | ||||
|       aria-relevant="all" | ||||
|       id="live-region-log" | ||||
|       role="log" | ||||
|     /> | ||||
|     <p | ||||
|       aria-live="polite" | ||||
|       aria-relevant="all" | ||||
|       id="live-region-status" | ||||
|       role="status" | ||||
|     /> | ||||
|     <p | ||||
|       aria-live="assertive" | ||||
|       aria-relevant="all" | ||||
|       id="live-region-alert" | ||||
|       role="alert" | ||||
|     /> | ||||
|   </div> | ||||
| </div> | ||||
| `; | ||||
| @ -12,14 +12,18 @@ import { Router } from 'react-router-dom'; | ||||
| import { createMemoryHistory } from 'history'; | ||||
| import FilterListURLQuery from '../index'; | ||||
| 
 | ||||
| const messages = { | ||||
|   en: {}, | ||||
| }; | ||||
| 
 | ||||
| const makeApp = (history, filtersSchema) => ( | ||||
|   <Router history={history}> | ||||
|     <ThemeProvider theme={lightTheme}> | ||||
|       <IntlProvider locale="en" messages={messages} textComponent="span"> | ||||
|       <IntlProvider | ||||
|         locale="en" | ||||
|         messages={{ | ||||
|           'components.FilterOptions.FILTER_TYPES.$eq': 'is', | ||||
|           'components.FilterOptions.FILTER_TYPES.$contains': 'contains', | ||||
|         }} | ||||
|         defaultLocale="en" | ||||
|         textComponent="span" | ||||
|       > | ||||
|         <FilterListURLQuery filtersSchema={filtersSchema} /> | ||||
|       </IntlProvider> | ||||
|     </ThemeProvider> | ||||
| @ -29,8 +33,56 @@ const makeApp = (history, filtersSchema) => ( | ||||
| describe('<FilterListURLQuery />', () => { | ||||
|   it('renders and matches the snapshot', () => { | ||||
|     const history = createMemoryHistory(); | ||||
|     render(makeApp(history)); | ||||
|     // expect(firstChild).toMatchInlineSnapshot();
 | ||||
|     // expect(true).toBe(true);
 | ||||
|     const filtersSchema = [ | ||||
|       { | ||||
|         name: 'bool', | ||||
|         metadatas: { label: 'bool' }, | ||||
|         fieldSchema: { type: 'boolean' }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'date', | ||||
|         metadatas: { label: 'date' }, | ||||
|         fieldSchema: { type: 'date' }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'enum', | ||||
|         metadatas: { label: 'enum' }, | ||||
|         fieldSchema: { type: 'enumeration', options: ['one', 'two', 'three'] }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'long', | ||||
|         metadatas: { label: 'long' }, | ||||
|         fieldSchema: { type: 'string' }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'many_to_one', | ||||
|         metadatas: { label: 'many_to_one' }, | ||||
|         fieldSchema: { | ||||
|           type: 'relation', | ||||
|           mainField: { | ||||
|             name: 'postal_code', | ||||
|             schema: { type: 'string', pluginOptions: { i18n: { localized: true } } }, | ||||
|           }, | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'number', | ||||
|         metadatas: { label: 'number' }, | ||||
|         fieldSchema: { type: 'integer' }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'time', | ||||
|         metadatas: { label: 'time' }, | ||||
|         fieldSchema: { type: 'time' }, | ||||
|       }, | ||||
|     ]; | ||||
|     history.push({ | ||||
|       pathname: '/', | ||||
|       search: | ||||
|         'sort=city&filters[$and][0][bool][$eq]=true&filters[$and][1][date][$eq]=2021-09-01&filters[$and][2][enum][$eq]=one&filters[$and][3][long][$eq]=test&filters[$and][4][many_to_one][postal_code][$eq]=test&filters[$and][5][number][$eq]=2&filters[$and][6][time][$contains]=00:45', | ||||
|     }); | ||||
|     const { container } = render(makeApp(history, filtersSchema)); | ||||
| 
 | ||||
|     expect(container).toMatchSnapshot(); | ||||
|   }); | ||||
| }); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 soupette
						soupette