Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Sunny_yiyi
Swagger Ui
提交
6d67c6da
S
Swagger Ui
项目概览
Sunny_yiyi
/
Swagger Ui
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Swagger Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6d67c6da
编写于
9月 19, 2017
作者:
K
kyle
提交者:
GitHub
9月 19, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3676 from owenconti/bug/3633-primitive-titles
Fixes #3633 - PrimitiveModel titles
上级
aa9e008f
69799b09
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
4 deletion
+55
-4
src/core/components/array-model.jsx
src/core/components/array-model.jsx
+1
-1
src/core/components/primitive-model.jsx
src/core/components/primitive-model.jsx
+2
-1
src/style/_models.scss
src/style/_models.scss
+2
-1
test/components/primitive-model.js
test/components/primitive-model.js
+49
-0
test/core/utils.js
test/core/utils.js
+1
-1
未找到文件。
src/core/components/array-model.jsx
浏览文件 @
6d67c6da
...
...
@@ -41,7 +41,7 @@ export default class ArrayModel extends Component {
{
properties
.
size
?
<
span
>
{
properties
.
entrySeq
().
map
(
(
[
key
,
v
]
)
=>
<
span
key
=
{
`
${
key
}
-
${
v
}
`
}
style
=
{
propStyle
}
>
<
br
/>
{
`
${
key
}
:`
}
{
String
(
v
)
}
</
span
>)
<
br
/>
{
key
}
:
{
String
(
v
)
}
</
span
>)
}
<
br
/></
span
>
:
null
}
...
...
src/core/components/primitive-model.jsx
浏览文件 @
6d67c6da
...
...
@@ -23,6 +23,7 @@ export default class Primitive extends Component {
let
format
=
schema
.
get
(
"
format
"
)
let
xml
=
schema
.
get
(
"
xml
"
)
let
enumArray
=
schema
.
get
(
"
enum
"
)
let
title
=
schema
.
get
(
"
title
"
)
||
name
let
description
=
schema
.
get
(
"
description
"
)
let
properties
=
schema
.
filter
(
(
v
,
key
)
=>
[
"
enum
"
,
"
type
"
,
"
format
"
,
"
description
"
,
"
$$ref
"
].
indexOf
(
key
)
===
-
1
)
const
Markdown
=
getComponent
(
"
Markdown
"
)
...
...
@@ -30,7 +31,7 @@ export default class Primitive extends Component {
return
<
span
className
=
"model"
>
<
span
className
=
"prop"
>
{
name
&&
<
span
className
=
{
`
${
depth
===
1
&&
"
model-title
"
}
prop-name`
}
>
{
nam
e
}
</
span
>
}
{
name
&&
<
span
className
=
{
`
${
depth
===
1
&&
"
model-title
"
}
prop-name`
}
>
{
titl
e
}
</
span
>
}
<
span
className
=
"prop-type"
>
{
type
}
</
span
>
{
format
&&
<
span
className
=
"prop-format"
>
($
{
format
}
)
</
span
>
}
{
...
...
src/style/_models.scss
浏览文件 @
6d67c6da
...
...
@@ -237,7 +237,8 @@ span
.prop-name
{
display
:
inline-block
;
width
:
100px
;
margin-right
:
1em
;
width
:
8em
;
}
.prop-type
...
...
test/components/primitive-model.js
0 → 100644
浏览文件 @
6d67c6da
/* eslint-env mocha */
import
React
from
"
react
"
import
expect
from
"
expect
"
import
{
shallow
}
from
"
enzyme
"
import
{
fromJS
}
from
"
immutable
"
import
PrimitiveModel
from
"
components/primitive-model
"
describe
(
"
<PrimitiveModel/>
"
,
function
()
{
describe
(
"
Model name
"
,
function
()
{
const
dummyComponent
=
()
=>
null
const
components
=
{
Markdown
:
dummyComponent
,
EnumModel
:
dummyComponent
}
const
props
=
{
getComponent
:
c
=>
components
[
c
],
name
:
"
Name from props
"
,
depth
:
1
,
schema
:
fromJS
({
type
:
"
string
"
,
title
:
"
Custom model title
"
})
}
it
(
"
renders the schema's title
"
,
function
()
{
// When
const
wrapper
=
shallow
(
<
PrimitiveModel
{...
props
}
/>
)
const
modelTitleEl
=
wrapper
.
find
(
"
span.model-title
"
)
expect
(
modelTitleEl
.
length
).
toEqual
(
1
)
// Then
expect
(
modelTitleEl
.
text
()
).
toEqual
(
"
Custom model title
"
)
})
it
(
"
falls back to the passed-in `name` prop for the title
"
,
function
()
{
// When
props
.
schema
=
fromJS
({
type
:
"
string
"
})
const
wrapper
=
shallow
(
<
PrimitiveModel
{...
props
}
/>
)
const
modelTitleEl
=
wrapper
.
find
(
"
span.model-title
"
)
expect
(
modelTitleEl
.
length
).
toEqual
(
1
)
// Then
expect
(
modelTitleEl
.
text
()
).
toEqual
(
"
Name from props
"
)
})
})
}
)
\ No newline at end of file
test/core/utils.js
浏览文件 @
6d67c6da
...
...
@@ -583,7 +583,7 @@ describe("utils", function() {
})
})
describe
.
only
(
"
getAcceptControllingResponse
"
,
()
=>
{
describe
(
"
getAcceptControllingResponse
"
,
()
=>
{
it
(
"
should return the first 2xx response with a media type
"
,
()
=>
{
const
responses
=
fromJSOrdered
({
"
200
"
:
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录