Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
4d2fbe65
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,发现更多精彩内容 >>
提交
4d2fbe65
编写于
1月 02, 2017
作者:
M
Mike Greiling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unnecessary fixtures and tests
上级
637dafde
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
2 addition
and
90 deletion
+2
-90
app/assets/javascripts/due_date_select.js.es6
app/assets/javascripts/due_date_select.js.es6
+2
-4
spec/javascripts/datetime_utility_spec.js.es6
spec/javascripts/datetime_utility_spec.js.es6
+0
-32
spec/javascripts/due_date_select_spec.js.es6
spec/javascripts/due_date_select_spec.js.es6
+0
-25
spec/javascripts/fixtures/due_date_select.html.haml
spec/javascripts/fixtures/due_date_select.html.haml
+0
-29
未找到文件。
app/assets/javascripts/due_date_select.js.es6
浏览文件 @
4d2fbe65
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
(function(global) {
(function(global) {
class DueDateSelect {
class DueDateSelect {
constructor({ $dropdown, $loading
, $context
} = {}) {
constructor({ $dropdown, $loading } = {}) {
const $dropdownParent = $dropdown.closest('.dropdown');
const $dropdownParent = $dropdown.closest('.dropdown');
const $block = $dropdown.closest('.block');
const $block = $dropdown.closest('.block');
this.$context = $context || $('body');
this.$loading = $loading;
this.$loading = $loading;
this.$dropdown = $dropdown;
this.$dropdown = $dropdown;
this.$dropdownParent = $dropdownParent;
this.$dropdownParent = $dropdownParent;
...
@@ -81,7 +80,7 @@
...
@@ -81,7 +80,7 @@
}
}
parseSelectedDate() {
parseSelectedDate() {
this.rawSelectedDate =
this.$context.find
(`input[name='${this.fieldName}']`).val();
this.rawSelectedDate =
$
(`input[name='${this.fieldName}']`).val();
if (this.rawSelectedDate.length) {
if (this.rawSelectedDate.length) {
// Avoid time zone inconsistency using the utils.createDateObject
// Avoid time zone inconsistency using the utils.createDateObject
...
@@ -180,6 +179,5 @@
...
@@ -180,6 +179,5 @@
}
}
global.DueDateSelectors = DueDateSelectors;
global.DueDateSelectors = DueDateSelectors;
global.DueDateSelect = DueDateSelect;
})(window.gl || (window.gl = {}));
})(window.gl || (window.gl = {}));
spec/javascripts/datetime_utility_spec.js.es6
浏览文件 @
4d2fbe65
...
@@ -2,38 +2,6 @@
...
@@ -2,38 +2,6 @@
(() => {
(() => {
describe('Date time utils', () => {
describe('Date time utils', () => {
describe('create date object', () => {
describe('using dashes', () => {
it('should instantiate the date object using integer params', () => {
spyOn(window, 'Date');
gl.utils.createDateObject('2016-11-12');
expect(window.Date).toHaveBeenCalledWith(2016, 10, 12);
});
it('should return the right date object ', () => {
const date = gl.utils.createDateObject('2016-11-12');
expect(date.getDate()).toBe(12);
expect(date.getMonth()).toBe(10);
expect(date.getFullYear()).toBe(2016);
});
});
describe('using slashes', () => {
it('should also instantiate the date object using integer params', () => {
spyOn(window, 'Date');
gl.utils.createDateObject('2016/08/02');
expect(window.Date).toHaveBeenCalledWith(2016, 7, 2);
});
it('should return the right date object', () => {
const date = gl.utils.createDateObject('2016/08/02');
expect(date.getDate()).toBe(2);
expect(date.getMonth()).toBe(7);
expect(date.getFullYear()).toBe(2016);
});
});
});
describe('get day name', () => {
describe('get day name', () => {
it('should return Sunday', () => {
it('should return Sunday', () => {
const day = gl.utils.getDayName(new Date('07/17/2016'));
const day = gl.utils.getDayName(new Date('07/17/2016'));
...
...
spec/javascripts/due_date_select_spec.js.es6
已删除
100644 → 0
浏览文件 @
637dafde
//= require lib/utils/datetime_utility
//= require jquery
//= require jquery-ui/datepicker
//= require gl_dropdown
//= require due_date_select
(() => {
describe('Due Date Select', () => {
describe('parseSelectedDate()', () => {
it('call create date object', () => {
const $dom = $(fixture.preload('due_date_select.html')[0]);
const dueDateSelect = new gl.DueDateSelect({
$context: $dom,
$dropdown: $dom.find('.js-due-date-select'),
$loading: $dom.find('.block-loading'),
});
spyOn(gl.utils, 'createDateObject');
dueDateSelect.parseSelectedDate();
expect(gl.utils.createDateObject).toHaveBeenCalledWith('2016-11-20');
});
});
});
})();
spec/javascripts/fixtures/due_date_select.html.haml
已删除
100644 → 0
浏览文件 @
637dafde
.block.due_date
.sidebar-collapsed-icon
%i
.fa.fa-calendar
%span
.js-due-date-sidebar-value
Nov 20, 2016
.title.hide-collapsed
Due date
%i
.fa.fa-spinner.fa-spin.block-loading
%a
.edit-link.pull-right
{
href:
"#"
}
Edit
.value.hide-collapsed
%span
.value-content
%span
.bold
Nov 20, 2016
%span
.no-value.js-remove-due-date-holder
%a
.js-remove-due-date
{
href:
"#"
,
role:
"button"
}
remove due date
.selectbox.hide-collapsed
%input
{
type:
"hidden"
,
name:
"issue[due_date]"
,
id:
"issue[due_date]"
,
value:
"2016-11-20"
}
.dropdown
%button
.dropdown-menu-toggle.js-due-date-select
{
type:
'button'
,
data:
{
toggle:
'dropdown'
,
field_name:
"issue[due_date]"
,
ability_name:
"issue"
,
issue_update:
"/h5bp/html5-boilerplate/issues/10.json"
}
}
%span
.dropdown-toggle-text
Due date
%i
.fa.fa-chevron-down
.dropdown-menu.dropdown-menu-due-date
.dropdown-title
%span
Due Date
%button
.dropdown-title-button.dropdown-menu-close
{
type:
"button"
}
%i
.fa.fa-times.dropdown-menu-close-icon
.dropdown-content
.js-due-date-calendar
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录