File tree Expand file tree Collapse file tree 3 files changed +29
-15
lines changed Expand file tree Collapse file tree 3 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -2,18 +2,19 @@ import React, { Component } from 'react';
22import { StyleSheet , Text , TextProps } from 'react-native' ;
33import Icon from '../Icon' ;
44import Flex , { FlexProps } from '../Flex' ;
5+ import { iconStr } from './svg' ;
56
6- const iconStr = `
7- <svg width="64" height="41" viewBox="0 0 64 41">
8- <g transform="translate(0 1)" fill="none" fill-rule="evenodd">
9- <ellipse fill="#F5F5F5" cx="32" cy="33" rx="32" ry="7"></ellipse>
10- <g fill-rule="nonzero" stroke="#D9D9D9">
11- <path fill="#FFF" d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path>
12- <path fill="#FAFAFA" d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z"></path>
13- </g>
14- </g>
15- </svg>
16- ` ;
7+ // export const iconStr = `
8+ // <svg width="64" height="41" viewBox="0 0 64 41">
9+ // <g transform="translate(0 1)" fill="none" fill-rule="evenodd">
10+ // <ellipse fill="#F5F5F5" cx="32" cy="33" rx="32" ry="7"></ellipse>
11+ // <g fill-rule="nonzero" stroke="#D9D9D9">
12+ // <path fill="#FFF" d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path>
13+ // <path fill="#FAFAFA" d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z"></path>
14+ // </g>
15+ // </g>
16+ // </svg>
17+ // `;
1718
1819export interface EmptyProps extends FlexProps {
1920 /**
Original file line number Diff line number Diff line change 1+ export const iconStr = `
2+ <svg width="64" height="41" viewBox="0 0 64 41">
3+ <g transform="translate(0 1)" fill="none" fill-rule="evenodd">
4+ <ellipse fill="#F5F5F5" cx="32" cy="33" rx="32" ry="7"></ellipse>
5+ <g fill-rule="nonzero" stroke="#D9D9D9">
6+ <path fill="#FFF" d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path>
7+ <path fill="#FAFAFA" d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z"></path>
8+ </g>
9+ </g>
10+ </svg>
11+ ` ;
Original file line number Diff line number Diff line change @@ -7,15 +7,17 @@ import React from 'react';
77import Empty from '../lib/Empty' ;
88// Note: test renderer must be required after react-native.
99import renderer from 'react-test-renderer' ;
10+ import { iconStr } from '../lib/Empty/svg' ;
1011
1112it ( 'Empty' , ( ) => {
1213 const component = renderer . create (
13- < Empty label = "冇得数据咯" size = { 120 } labelStyle = { { color : 'red' } } > 冇得数据咯</ Empty >
14+ < Empty label = "冇得数据咯" size = { 120 } labelStyle = { { color : 'red' } } xml = { iconStr } >
15+ 冇得数据咯
16+ </ Empty > ,
1417 ) ;
1518 expect ( component . root . props . label ) . toBe ( '冇得数据咯' ) ;
1619 expect ( component . root . props . size ) . toBe ( 120 ) ;
1720 expect ( component . root . props . labelStyle ) . toBeTruthy ( ) ;
18- expect ( component . root . props . xml ) . toBeTruthy ( ) ;
21+ expect ( component . root . props . xml ) . toStrictEqual ( iconStr ) ;
1922 expect ( component . root . props . children ) . toBe ( '冇得数据咯' ) ;
20-
21- } ) ;
23+ } ) ;
You can’t perform that action at this time.
0 commit comments