refactor Todos class to ES module syntax

This commit is contained in:
Mike Greiling 2017-07-06 12:57:01 -05:00
parent 4ad4efb8fd
commit 571de11eb6
4 changed files with 5 additions and 8 deletions

View file

@ -51,6 +51,7 @@ import UsersSelect from './users_select';
import RefSelectDropdown from './ref_select_dropdown';
import GfmAutoComplete from './gfm_auto_complete';
import ShortcutsBlob from './shortcuts_blob';
import Todos from './todos';
import TreeView from './tree';
import UsagePing from './usage_ping';
import UsernameValidator from './username_validator';
@ -166,7 +167,7 @@ import OAuthRememberMe from './oauth_remember_me';
new UsersSelect();
break;
case 'dashboard:todos:index':
new gl.Todos();
new Todos();
break;
case 'dashboard:projects:index':
case 'dashboard:projects:starred':

View file

@ -152,7 +152,6 @@ import './subscription';
import './subscription_select';
import './syntax_highlight';
import './task_list';
import './todos';
import './user';
// eslint-disable-next-line global-require, import/no-commonjs

View file

@ -2,7 +2,7 @@
import UsersSelect from './users_select';
class Todos {
export default class Todos {
constructor() {
this.initFilters();
this.bindEvents();
@ -159,6 +159,3 @@ class Todos {
}
}
}
window.gl = window.gl || {};
gl.Todos = Todos;

View file

@ -1,4 +1,4 @@
import '~/todos';
import Todos from '~/todos';
import '~/lib/utils/common_utils';
describe('Todos', () => {
@ -9,7 +9,7 @@ describe('Todos', () => {
loadFixtures('todos/todos.html.raw');
todoItem = document.querySelector('.todos-list .todo');
return new gl.Todos();
return new Todos();
});
describe('goToTodoUrl', () => {