Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
409a3250
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
409a3250
编写于
2月 10, 2017
作者:
W
winniehell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace static fixture for behaviors/requires_input_spec.js (!9162)
上级
640e977d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
24 deletion
+11
-24
changelogs/unreleased/requires-input-fixture.yml
changelogs/unreleased/requires-input-fixture.yml
+4
-0
spec/javascripts/behaviors/requires_input_spec.js
spec/javascripts/behaviors/requires_input_spec.js
+7
-6
spec/javascripts/fixtures/behaviors/requires_input.html.haml
spec/javascripts/fixtures/behaviors/requires_input.html.haml
+0
-18
未找到文件。
changelogs/unreleased/requires-input-fixture.yml
0 → 100644
浏览文件 @
409a3250
---
title
:
Replace static fixture for behaviors/requires_input_spec.js
merge_request
:
9162
author
:
winniehell
spec/javascripts/behaviors/requires_input_spec.js
浏览文件 @
409a3250
...
...
@@ -4,18 +4,19 @@ require('~/behaviors/requires_input');
(
function
()
{
describe
(
'
requiresInput
'
,
function
()
{
preloadFixtures
(
'
static/behaviors/requires_input
.html.raw
'
);
preloadFixtures
(
'
branches/new_branch
.html.raw
'
);
beforeEach
(
function
()
{
return
loadFixtures
(
'
static/behaviors/requires_input.html.raw
'
);
loadFixtures
(
'
branches/new_branch.html.raw
'
);
this
.
submitButton
=
$
(
'
button[type="submit"]
'
);
});
it
(
'
disables submit when any field is required
'
,
function
()
{
$
(
'
.js-requires-input
'
).
requiresInput
();
return
expect
(
$
(
'
.submit
'
)
).
toBeDisabled
();
return
expect
(
this
.
submitButton
).
toBeDisabled
();
});
it
(
'
enables submit when no field is required
'
,
function
()
{
$
(
'
*[required=required]
'
).
removeAttr
(
'
required
'
);
$
(
'
.js-requires-input
'
).
requiresInput
();
return
expect
(
$
(
'
.submit
'
)
).
not
.
toBeDisabled
();
return
expect
(
this
.
submitButton
).
not
.
toBeDisabled
();
});
it
(
'
enables submit when all required fields are pre-filled
'
,
function
()
{
$
(
'
*[required=required]
'
).
remove
();
...
...
@@ -25,9 +26,9 @@ require('~/behaviors/requires_input');
it
(
'
enables submit when all required fields receive input
'
,
function
()
{
$
(
'
.js-requires-input
'
).
requiresInput
();
$
(
'
#required1
'
).
val
(
'
input1
'
).
change
();
expect
(
$
(
'
.submit
'
)
).
toBeDisabled
();
expect
(
this
.
submitButton
).
toBeDisabled
();
$
(
'
#optional1
'
).
val
(
'
input1
'
).
change
();
expect
(
$
(
'
.submit
'
)
).
toBeDisabled
();
expect
(
this
.
submitButton
).
toBeDisabled
();
$
(
'
#required2
'
).
val
(
'
input2
'
).
change
();
$
(
'
#required3
'
).
val
(
'
input3
'
).
change
();
$
(
'
#required4
'
).
val
(
'
input4
'
).
change
();
...
...
spec/javascripts/fixtures/behaviors/requires_input.html.haml
已删除
100644 → 0
浏览文件 @
640e977d
%form
.js-requires-input
%input
{
type:
'text'
,
id:
'required1'
,
required:
'required'
}
%input
{
type:
'text'
,
id:
'required2'
,
required:
'required'
}
%input
{
type:
'text'
,
id:
'required3'
,
required:
'required'
,
value:
'Pre-filled'
}
%input
{
type:
'text'
,
id:
'optional1'
}
%textarea
{
id:
'required4'
,
required:
'required'
}
%textarea
{
id:
'optional2'
}
%select
{
id:
'required5'
,
required:
'required'
}
%option
Zero
%option
{
value:
'1'
}
One
%select
{
id:
'optional3'
,
required:
'required'
}
%option
Zero
%option
{
value:
'1'
}
One
%button
.submit
{
type:
'submit'
,
value:
'Submit'
}
%input
.submit
{
type:
'submit'
,
value:
'Submit'
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录