Commit 7974aa9c authored by Robert Knight's avatar Robert Knight

Fix inconsistent component exports

This fixes a small inconsistency in that most component modules exported
the object defining the component directly, whereas others exported an
object with the component as a property. There is no good reason to do
the latter.
parent a48ef194
...@@ -129,7 +129,7 @@ module.exports = angular.module('h', [ ...@@ -129,7 +129,7 @@ module.exports = angular.module('h', [
.component('hypothesisApp', require('./components/hypothesis-app')) .component('hypothesisApp', require('./components/hypothesis-app'))
// UI components // UI components
.component('annotation', require('./components/annotation').component) .component('annotation', require('./components/annotation'))
.component('annotationShareDialog', require('./components/annotation-share-dialog')) .component('annotationShareDialog', require('./components/annotation-share-dialog'))
.component('annotationThread', require('./components/annotation-thread')) .component('annotationThread', require('./components/annotation-thread'))
.component('annotationViewerContent', require('./components/annotation-viewer-content')) .component('annotationViewerContent', require('./components/annotation-viewer-content'))
...@@ -140,7 +140,7 @@ module.exports = angular.module('h', [ ...@@ -140,7 +140,7 @@ module.exports = angular.module('h', [
.component('helpPanel', require('./components/help-panel')) .component('helpPanel', require('./components/help-panel'))
.component('loggedoutMessage', require('./components/loggedout-message')) .component('loggedoutMessage', require('./components/loggedout-message'))
.component('loginControl', require('./components/login-control')) .component('loginControl', require('./components/login-control'))
.component('loginForm', require('./components/login-form').component) .component('loginForm', require('./components/login-form'))
.component('markdown', require('./components/markdown')) .component('markdown', require('./components/markdown'))
.component('moderationBanner', require('./components/moderation-banner')) .component('moderationBanner', require('./components/moderation-banner'))
.component('publishAnnotationBtn', require('./components/publish-annotation-btn')) .component('publishAnnotationBtn', require('./components/publish-annotation-btn'))
...@@ -148,7 +148,7 @@ module.exports = angular.module('h', [ ...@@ -148,7 +148,7 @@ module.exports = angular.module('h', [
.component('searchStatusBar', require('./components/search-status-bar')) .component('searchStatusBar', require('./components/search-status-bar'))
.component('selectionTabs', require('./components/selection-tabs')) .component('selectionTabs', require('./components/selection-tabs'))
.component('sidebarContent', require('./components/sidebar-content')) .component('sidebarContent', require('./components/sidebar-content'))
.component('sidebarTutorial', require('./components/sidebar-tutorial').component) .component('sidebarTutorial', require('./components/sidebar-tutorial'))
.component('shareDialog', require('./components/share-dialog')) .component('shareDialog', require('./components/share-dialog'))
.component('sortDropdown', require('./components/sort-dropdown')) .component('sortDropdown', require('./components/sort-dropdown'))
.component('streamContent', require('./components/stream-content')) .component('streamContent', require('./components/stream-content'))
......
...@@ -573,7 +573,7 @@ function AnnotationController( ...@@ -573,7 +573,7 @@ function AnnotationController(
init(); init();
} }
var component = { module.exports = {
controller: AnnotationController, controller: AnnotationController,
controllerAs: 'vm', controllerAs: 'vm',
bindings: { bindings: {
...@@ -584,17 +584,7 @@ var component = { ...@@ -584,17 +584,7 @@ var component = {
isCollapsed: '<', isCollapsed: '<',
}, },
template: require('../templates/annotation.html'), template: require('../templates/annotation.html'),
};
module.exports = { // Private helper exposed for use in unit tests.
// These private helper functions aren't meant to be part of the public
// interface of this module. They've been exported temporarily to enable them
// to be unit tested.
// FIXME: The code should be refactored to enable unit testing without having
// to do this.
updateModel: updateModel, updateModel: updateModel,
// These are meant to be the public API of this module.
component: component,
Controller: AnnotationController,
}; };
...@@ -96,7 +96,7 @@ function Controller($scope, $timeout, analytics, flash, session, formRespond, se ...@@ -96,7 +96,7 @@ function Controller($scope, $timeout, analytics, flash, session, formRespond, se
}); });
} }
var component = { module.exports = {
controller: Controller, controller: Controller,
controllerAs: 'vm', controllerAs: 'vm',
bindings: { bindings: {
...@@ -104,8 +104,3 @@ var component = { ...@@ -104,8 +104,3 @@ var component = {
}, },
template: require('../templates/login_form.html'), template: require('../templates/login_form.html'),
}; };
module.exports = {
component: component,
Controller: Controller,
};
...@@ -22,11 +22,8 @@ function SidebarTutorialController(session) { ...@@ -22,11 +22,8 @@ function SidebarTutorialController(session) {
*/ */
// @ngInject // @ngInject
module.exports = { module.exports = {
component: { controller: SidebarTutorialController,
controller: SidebarTutorialController, controllerAs: 'vm',
controllerAs: 'vm', bindings: {},
bindings: {}, template: require('../templates/sidebar_tutorial.html'),
template: require('../templates/sidebar_tutorial.html'),
},
Controller: SidebarTutorialController,
}; };
/* jshint node: true */
'use strict'; 'use strict';
var angular = require('angular'); var angular = require('angular');
...@@ -23,7 +22,7 @@ var fakeDocumentMeta = { ...@@ -23,7 +22,7 @@ var fakeDocumentMeta = {
function annotationComponent() { function annotationComponent() {
var noop = function () { return ''; }; var noop = function () { return ''; };
var annotation = proxyquire('../annotation', { return proxyquire('../annotation', {
angular: testUtil.noCallThru(angular), angular: testUtil.noCallThru(angular),
'../filter/persona': { '../filter/persona': {
username: noop, username: noop,
...@@ -34,8 +33,6 @@ function annotationComponent() { ...@@ -34,8 +33,6 @@ function annotationComponent() {
}, },
}, },
}); });
return annotation.component;
} }
describe('annotation', function() { describe('annotation', function() {
......
...@@ -31,7 +31,7 @@ describe 'loginForm.Controller', -> ...@@ -31,7 +31,7 @@ describe 'loginForm.Controller', ->
before -> before ->
angular.module('h', []) angular.module('h', [])
.controller('loginFormController', require('../login-form').Controller) .controller('loginFormController', require('../login-form').controller)
beforeEach module('h') beforeEach module('h')
......
'use strict'; 'use strict';
var Controller = require('../sidebar-tutorial').Controller; var Controller = require('../sidebar-tutorial').controller;
describe('SidebarTutorialController', function () { describe('SidebarTutorialController', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment