Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
60a1118f
Commit
60a1118f
authored
Jul 06, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor SigninTabsMemoizer class to ES module syntax
parent
5c52ca9a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+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
No files found.
app/assets/javascripts/dispatcher.js
View file @
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 */
/* 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 ShortcutsNavigation */
/* global IssuableIndex */
/* global IssuableIndex */
/* global ShortcutsIssuable */
/* global ShortcutsIssuable */
...
@@ -50,6 +49,7 @@ import UsersSelect from './users_select';
...
@@ -50,6 +49,7 @@ import UsersSelect from './users_select';
import
RefSelectDropdown
from
'
./ref_select_dropdown
'
;
import
RefSelectDropdown
from
'
./ref_select_dropdown
'
;
import
GfmAutoComplete
from
'
./gfm_auto_complete
'
;
import
GfmAutoComplete
from
'
./gfm_auto_complete
'
;
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
SigninTabsMemoizer
from
'
./signin_tabs_memoizer
'
;
import
Star
from
'
./star
'
;
import
Star
from
'
./star
'
;
import
Todos
from
'
./todos
'
;
import
Todos
from
'
./todos
'
;
import
TreeView
from
'
./tree
'
;
import
TreeView
from
'
./tree
'
;
...
@@ -131,7 +131,7 @@ import OAuthRememberMe from './oauth_remember_me';
...
@@ -131,7 +131,7 @@ import OAuthRememberMe from './oauth_remember_me';
break
;
break
;
case
'
sessions:new
'
:
case
'
sessions:new
'
:
new
UsernameValidator
();
new
UsernameValidator
();
new
ActiveTab
Memoizer
();
new
SigninTabs
Memoizer
();
new
OAuthRememberMe
({
container
:
$
(
"
.omniauth-container
"
)
}).
bindEvents
();
new
OAuthRememberMe
({
container
:
$
(
"
.omniauth-container
"
)
}).
bindEvents
();
break
;
break
;
case
'
projects:boards:show
'
:
case
'
projects:boards:show
'
:
...
...
app/assets/javascripts/main.js
View file @
60a1118f
...
@@ -143,7 +143,6 @@ import './render_math';
...
@@ -143,7 +143,6 @@ import './render_math';
import
'
./right_sidebar
'
;
import
'
./right_sidebar
'
;
import
'
./search
'
;
import
'
./search
'
;
import
'
./search_autocomplete
'
;
import
'
./search_autocomplete
'
;
import
'
./signin_tabs_memoizer
'
;
import
'
./smart_interval
'
;
import
'
./smart_interval
'
;
import
'
./snippets_list
'
;
import
'
./snippets_list
'
;
import
'
./star
'
;
import
'
./star
'
;
...
...
app/assets/javascripts/signin_tabs_memoizer.js
View file @
60a1118f
...
@@ -6,7 +6,7 @@ import AccessorUtilities from './lib/utils/accessor';
...
@@ -6,7 +6,7 @@ import AccessorUtilities from './lib/utils/accessor';
* Memorize the last selected tab after reloading a page.
* Memorize the last selected tab after reloading a page.
* Does that setting the current selected tab in the localStorage
* 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
'
}
=
{})
{
constructor
({
currentTabKey
=
'
current_signin_tab
'
,
tabSelector
=
'
ul.nav-tabs
'
}
=
{})
{
this
.
currentTabKey
=
currentTabKey
;
this
.
currentTabKey
=
currentTabKey
;
this
.
tabSelector
=
tabSelector
;
this
.
tabSelector
=
tabSelector
;
...
@@ -51,5 +51,3 @@ class ActiveTabMemoizer {
...
@@ -51,5 +51,3 @@ class ActiveTabMemoizer {
return
window
.
localStorage
.
getItem
(
this
.
currentTabKey
);
return
window
.
localStorage
.
getItem
(
this
.
currentTabKey
);
}
}
}
}
window
.
ActiveTabMemoizer
=
ActiveTabMemoizer
;
spec/javascripts/signin_tabs_memoizer_spec.js
View file @
60a1118f
import
AccessorUtilities
from
'
~/lib/utils/accessor
'
;
import
AccessorUtilities
from
'
~/lib/utils/accessor
'
;
import
SigninTabsMemoizer
from
'
~/signin_tabs_memoizer
'
;
import
'
~/signin_tabs_memoizer
'
;
(()
=>
{
((
global
)
=>
{
describe
(
'
SigninTabsMemoizer
'
,
()
=>
{
describe
(
'
SigninTabsMemoizer
'
,
()
=>
{
const
fixtureTemplate
=
'
static/signin_tabs.html.raw
'
;
const
fixtureTemplate
=
'
static/signin_tabs.html.raw
'
;
const
tabSelector
=
'
ul.nav-tabs
'
;
const
tabSelector
=
'
ul.nav-tabs
'
;
...
@@ -10,7 +9,7 @@ import '~/signin_tabs_memoizer';
...
@@ -10,7 +9,7 @@ import '~/signin_tabs_memoizer';
let
memo
;
let
memo
;
function
createMemoizer
()
{
function
createMemoizer
()
{
memo
=
new
global
.
ActiveTab
Memoizer
({
memo
=
new
SigninTabs
Memoizer
({
currentTabKey
,
currentTabKey
,
tabSelector
,
tabSelector
,
});
});
...
@@ -78,7 +77,7 @@ import '~/signin_tabs_memoizer';
...
@@ -78,7 +77,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
false
;
memo
.
isLocalStorageAvailable
=
false
;
global
.
ActiveTab
Memoizer
.
prototype
.
saveData
.
call
(
memo
);
SigninTabs
Memoizer
.
prototype
.
saveData
.
call
(
memo
);
});
});
it
(
'
should not call .setItem
'
,
()
=>
{
it
(
'
should not call .setItem
'
,
()
=>
{
...
@@ -92,7 +91,7 @@ import '~/signin_tabs_memoizer';
...
@@ -92,7 +91,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
true
;
memo
.
isLocalStorageAvailable
=
true
;
global
.
ActiveTab
Memoizer
.
prototype
.
saveData
.
call
(
memo
,
value
);
SigninTabs
Memoizer
.
prototype
.
saveData
.
call
(
memo
,
value
);
});
});
it
(
'
should call .setItem
'
,
()
=>
{
it
(
'
should call .setItem
'
,
()
=>
{
...
@@ -117,7 +116,7 @@ import '~/signin_tabs_memoizer';
...
@@ -117,7 +116,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
false
;
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`
'
,
()
=>
{
it
(
'
should not call .getItem and should return `null`
'
,
()
=>
{
...
@@ -130,7 +129,7 @@ import '~/signin_tabs_memoizer';
...
@@ -130,7 +129,7 @@ import '~/signin_tabs_memoizer';
beforeEach
(
function
()
{
beforeEach
(
function
()
{
memo
.
isLocalStorageAvailable
=
true
;
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
'
,
()
=>
{
it
(
'
should call .getItem and return the localStorage value
'
,
()
=>
{
...
@@ -140,4 +139,4 @@ import '~/signin_tabs_memoizer';
...
@@ -140,4 +139,4 @@ import '~/signin_tabs_memoizer';
});
});
});
});
});
});
})(
window
);
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment