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', [
.component('hypothesisApp', require('./components/hypothesis-app'))
// UI components
.component('annotation', require('./components/annotation').component)
.component('annotation', require('./components/annotation'))
.component('annotationShareDialog', require('./components/annotation-share-dialog'))
.component('annotationThread', require('./components/annotation-thread'))
.component('annotationViewerContent', require('./components/annotation-viewer-content'))
......@@ -140,7 +140,7 @@ module.exports = angular.module('h', [
.component('helpPanel', require('./components/help-panel'))
.component('loggedoutMessage', require('./components/loggedout-message'))
.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('moderationBanner', require('./components/moderation-banner'))
.component('publishAnnotationBtn', require('./components/publish-annotation-btn'))
......@@ -148,7 +148,7 @@ module.exports = angular.module('h', [
.component('searchStatusBar', require('./components/search-status-bar'))
.component('selectionTabs', require('./components/selection-tabs'))
.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('sortDropdown', require('./components/sort-dropdown'))
.component('streamContent', require('./components/stream-content'))
......
......@@ -573,7 +573,7 @@ function AnnotationController(
init();
}
var component = {
module.exports = {
controller: AnnotationController,
controllerAs: 'vm',
bindings: {
......@@ -584,17 +584,7 @@ var component = {
isCollapsed: '<',
},
template: require('../templates/annotation.html'),
};
module.exports = {
// 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.
// Private helper exposed for use in unit tests.
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
});
}
var component = {
module.exports = {
controller: Controller,
controllerAs: 'vm',
bindings: {
......@@ -104,8 +104,3 @@ var component = {
},
template: require('../templates/login_form.html'),
};
module.exports = {
component: component,
Controller: Controller,
};
......@@ -22,11 +22,8 @@ function SidebarTutorialController(session) {
*/
// @ngInject
module.exports = {
component: {
controller: SidebarTutorialController,
controllerAs: 'vm',
bindings: {},
template: require('../templates/sidebar_tutorial.html'),
},
Controller: SidebarTutorialController,
controller: SidebarTutorialController,
controllerAs: 'vm',
bindings: {},
template: require('../templates/sidebar_tutorial.html'),
};
/* jshint node: true */
'use strict';
var angular = require('angular');
......@@ -23,7 +22,7 @@ var fakeDocumentMeta = {
function annotationComponent() {
var noop = function () { return ''; };
var annotation = proxyquire('../annotation', {
return proxyquire('../annotation', {
angular: testUtil.noCallThru(angular),
'../filter/persona': {
username: noop,
......@@ -34,8 +33,6 @@ function annotationComponent() {
},
},
});
return annotation.component;
}
describe('annotation', function() {
......
......@@ -31,7 +31,7 @@ describe 'loginForm.Controller', ->
before ->
angular.module('h', [])
.controller('loginFormController', require('../login-form').Controller)
.controller('loginFormController', require('../login-form').controller)
beforeEach module('h')
......
'use strict';
var Controller = require('../sidebar-tutorial').Controller;
var Controller = require('../sidebar-tutorial').controller;
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