File tree Expand file tree Collapse file tree 3 files changed +30
-8
lines changed
Expand file tree Collapse file tree 3 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,14 @@ it("renders schema methods tags", () => {
150150 ] ,
151151 } ,
152152 } ,
153- tags : [ "tag3" , "tag4" ] ,
153+ tags : [
154+ {
155+ name : "tag3" ,
156+ } ,
157+ {
158+ name : "tag4" ,
159+ }
160+ ]
154161 } ,
155162 {
156163 result : {
@@ -172,7 +179,14 @@ it("renders schema methods tags", () => {
172179 ] ,
173180 } ,
174181 } ,
175- tags : [ "salad" , "mytag" ] ,
182+ tags : [
183+ {
184+ name : "salad" ,
185+ } ,
186+ {
187+ name : "mytag" ,
188+ } ,
189+ ] ,
176190 } ,
177191 ] ,
178192 } ;
Original file line number Diff line number Diff line change @@ -11,7 +11,14 @@ it("renders empty with empty tags", () => {
1111
1212it ( "renders schema tags" , ( ) => {
1313 const div = document . createElement ( "div" ) ;
14- const tags = [ "salad" , "mytag" ] ;
14+ const tags = [
15+ {
16+ name : "salad" ,
17+ } ,
18+ {
19+ name : "mytag" ,
20+ }
21+ ] ;
1522 ReactDOM . render ( < Tags tags = { tags } /> , div ) ;
1623 expect ( div . innerHTML . includes ( "salad" ) ) . toBe ( true ) ;
1724 expect ( div . innerHTML . includes ( "mytag" ) ) . toBe ( true ) ;
Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ import { Chip } from "@material-ui/core";
44const hashColor = require ( "hash-color-material" ) ;
55
66interface IProps {
7- tags ?: string [ ] ;
7+ tags ?: types . TagObject [ ] ;
88}
99
1010export default class Tags extends Component < IProps > {
1111 public render ( ) {
12- const { tags } = this . props ;
12+ const { tags } : { tags ?: any } = this . props ;
1313 if ( ! tags || tags . length === 0 ) {
1414 return null ;
1515 }
@@ -19,9 +19,10 @@ export default class Tags extends Component<IProps> {
1919 tags . map ( ( tag : any , k : number ) => {
2020 return (
2121 < Chip
22- key = { tag }
23- label = { tag }
24- style = { { backgroundColor : hashColor . getColorFromString ( tag , false ) } } />
22+ key = { tag . name }
23+ label = { tag . name }
24+ style = { { backgroundColor : hashColor . getColorFromString ( tag . name , false ) } }
25+ />
2526 ) ;
2627 } )
2728 }
You can’t perform that action at this time.
0 commit comments