Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
60a1118f
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,体验更适合开发者的 AI 搜索 >>
提交
60a1118f
编写于
7月 06, 2017
作者:
M
Mike Greiling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor SigninTabsMemoizer class to ES module syntax
上级
5c52ca9a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
15 deletion
+11
-15
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+2
-2
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/assets/javascripts/signin_tabs_memoizer.js
app/assets/javascripts/signin_tabs_memoizer.js
+1
-3
spec/javascripts/signin_tabs_memoizer_spec.js
spec/javascripts/signin_tabs_memoizer_spec.js
+8
-9
未找到文件。
app/assets/javascripts/dispatcher.js
浏览文件 @
60a1118f
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
/* global ActiveTabMemoizer */
/* global ShortcutsNavigation */
/* global IssuableIndex */
/* global ShortcutsIssuable */
...
...
@@ -50,6 +49,7 @@ import UsersSelect from './users_select';
import
RefSelectDropdown
from
'
./ref_select_dropdown
'
;
import
GfmAutoComplete
from
'
./gfm_auto_complete
'
;
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
SigninTabsMemoizer
from
'
./signin_tabs_memoizer
'
;
import
Star
from
'
./star
'
;
import
Todos
from
'
./todos
'
;
import
TreeView
from
'
./tree
'
;
...
...
@@ -131,7 +131,7 @@ import OAuthRememberMe from './oauth_remember_me';
break
;
case
'
sessions:new
'
:
new
UsernameValidator
();
new
ActiveTab
Memoizer
();
new
SigninTabs
Memoizer
();
new
OAuthRememberMe
({
container
:
$
(
"
.omniauth-container
"
)
}).
bindEvents
();
break
;
case
'
projects:boards:show
'
:
...
...
app/assets/javascripts/main.js
浏览文件 @
60a1118f
...
...
@@ -143,7 +143,6 @@ import './render_math';
import
'
./right_sidebar
'
;
import
'
./search
'
;
import
'
./search_autocomplete
'
;
import
'
./signin_tabs_memoizer
'
;
import
'
./smart_interval
'
;
import
'
./snippets_list
'
;
import
'
./star
'
;
...
...
app/assets/javascripts/signin_tabs_memoizer.js
浏览文件 @
60a1118f
...
...
@@ -6,7 +6,7 @@ import AccessorUtilities from './lib/utils/accessor';
* Memorize the last selected tab after reloading a page.
* Does that setting the current selected tab in the localStorage
*/
class
ActiveTab
Memoizer
{
export
default
class
SigninTabs
Memoizer
{
constructor
({
currentTabKey
=
'
current_signin_tab
'
,
tabSelector
=
'
ul.nav-tabs
'
}
=
{})
{
this
.
currentTabKey
=
currentTabKey
;
this
.
tabSelector
=
tabSelector
;
...
...
@@ -51,5 +51,3 @@ class ActiveTabMemoizer {
return
window
.
localStorage
.
getItem
(
this
.
currentTabKey
);
}
}
window
.
ActiveTabMemoizer
=
ActiveTabMemoizer
;
spec/javascripts/signin_tabs_memoizer_spec.js
浏览文件 @
60a1118f
import
AccessorUtilities
from
'
~/lib/utils/accessor
'
;
import
SigninTabsMemoizer
from
'
~/signin_tabs_memoizer
'
;
import
'
~/signin_tabs_memoizer
'
;
((
global
)
=>
{
(()
=>
{
describe
(
'
SigninTabsMemoizer
'
,
()
=>
{
const
fixtureTemplate
=
'
static/signin_tabs.html.raw
'
;
const
tabSelector
=
'
ul.nav-tabs
'
;
...
...
@@ -10,7 +9,7 @@ import '~/signin_tabs_memoizer';
let
memo
;
function
createMemoizer
()
{
memo
=
new
global
.
ActiveTab
Memoizer
({
memo
=
new
SigninTabs
Memoizer
({
currentTabKey
,
tabSelector
,
});
...
...
@@ -78,7 +77,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
false
;
global
.
ActiveTab
Memoizer
.
prototype
.
saveData
.
call
(
memo
);
SigninTabs
Memoizer
.
prototype
.
saveData
.
call
(
memo
);
});
it
(
'
should not call .setItem
'
,
()
=>
{
...
...
@@ -92,7 +91,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
true
;
global
.
ActiveTab
Memoizer
.
prototype
.
saveData
.
call
(
memo
,
value
);
SigninTabs
Memoizer
.
prototype
.
saveData
.
call
(
memo
,
value
);
});
it
(
'
should call .setItem
'
,
()
=>
{
...
...
@@ -117,7 +116,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
false
;
readData
=
global
.
ActiveTab
Memoizer
.
prototype
.
readData
.
call
(
memo
);
readData
=
SigninTabs
Memoizer
.
prototype
.
readData
.
call
(
memo
);
});
it
(
'
should not call .getItem and should return `null`
'
,
()
=>
{
...
...
@@ -130,7 +129,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
true
;
readData
=
global
.
ActiveTab
Memoizer
.
prototype
.
readData
.
call
(
memo
);
readData
=
SigninTabs
Memoizer
.
prototype
.
readData
.
call
(
memo
);
});
it
(
'
should call .getItem and return the localStorage value
'
,
()
=>
{
...
...
@@ -140,4 +139,4 @@ import '~/signin_tabs_memoizer';
});
});
});
})(
window
);
})();
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录