Skip to content

Commit b158e81

Browse files
committed
Upgrade ember 2.18->3.4
fixing up tests
1 parent 93a34d4 commit b158e81

File tree

86 files changed

+4487
-2799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+4487
-2799
lines changed

.eslintignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# unconventional js
2+
/blueprints/*/files/
3+
/vendor/
4+
5+
# compiled output
6+
/dist/
7+
/tmp/
8+
9+
# dependencies
10+
/bower_components/
11+
12+
# misc
13+
/coverage/
14+
15+
# ember-try
16+
/.node_modules.ember-try/
17+
/bower.json.ember-try
18+
/package.json.ember-try

.eslintrc.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
// node files
2424
{
2525
files: [
26+
'.template-lintrc.js',
2627
'ember-cli-build.js',
2728
'testem.js',
2829
'blueprints/*/index.js',
@@ -38,15 +39,6 @@ module.exports = {
3839
browser: false,
3940
node: true
4041
}
41-
},
42-
43-
// test files
44-
{
45-
files: ['tests/**/*.js'],
46-
excludedFiles: ['tests/dummy/**/*.js'],
47-
env: {
48-
embertest: true
49-
}
5042
}
5143
]
5244
};

.gitignore

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ terraform.tfstate.backup
99
.envrc
1010

1111
# compiled output
12-
/dist
13-
/tmp
12+
/dist/
13+
/tmp/
1414

1515
# dependencies
16-
/node_modules
17-
/bower_components
16+
/bower_components/
17+
/node_modules/
1818

1919
# misc
2020
/.projectile
2121
/.sass-cache
2222
/connect.lock
23-
/coverage/*
23+
/coverage/
2424
/libpeerconnection.log
25-
npm-debug.log*
26-
yarn-error.log
27-
testem.log
25+
/npm-debug.log*
26+
/testem.log
27+
/yarn-error.log
2828

2929
public/json-docs/
3030
public/rev-index/
@@ -36,3 +36,8 @@ package-lock.json
3636
browserstack-local.pid
3737
local.log
3838
.vscode/
39+
40+
# ember-try
41+
/.node_modules.ember-try/
42+
/bower.json.ember-try
43+
/package.json.ember-try

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ To run a11y tests, run `test_a11y=yes ember serve`
5252
## Staging Environment
5353
Latest changes from master can be seen on https://ember-api-docs-frontend-staging.global.ssl.fastly.net/
5454

55-
---
55+
### Linting
56+
57+
* `yarn run lint:hbs`
58+
* `yarn run lint:js`
59+
* `yarn run lint:js -- --fix`
60+
61+
### Building
5662

5763
Cross-browser testing provided by:
5864

app/adapters/application.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ export default JSONAPIAdapter.extend({
2020

2121
async findRecord(store, {modelName}, id) {
2222
let url;
23-
let host = this.get('host');
24-
let projectName = this.get('currentProject');
23+
let host = this.host;
24+
let projectName = this.currentProject;
2525

2626
if (['namespace', 'class', 'module'].indexOf(modelName) > -1) {
2727
let [version] = id.replace(`${projectName}-`, '').split('-');
28-
let revId = this.get('metaStore').getRevId(projectName, version, modelName, id);
28+
let revId = this.metaStore.getRevId(projectName, version, modelName, id);
2929

3030
let modelNameToUse = modelName;
3131
// To account for namespaces that are also classes but not defined properly in yuidocs
3232
if (isBlank(revId) && modelNameToUse === 'class') {
33-
revId = this.get('metaStore').getRevId(projectName, version, 'namespace', id);
33+
revId = this.metaStore.getRevId(projectName, version, 'namespace', id);
3434
modelNameToUse = 'namespace';
3535
}
3636

@@ -42,7 +42,7 @@ export default JSONAPIAdapter.extend({
4242
}
4343
} else if (modelName === 'missing') {
4444
let version = this.get('projectService.version');
45-
let revId = this.get('metaStore').getRevId(projectName, version, modelName, id);
45+
let revId = this.metaStore.getRevId(projectName, version, modelName, id);
4646
url = `json-docs/${projectName}/${version}/${pluralize(modelName)}/${revId}`;
4747
} else if (modelName === 'project') {
4848
this.set('currentProject', id);

app/components/api-index-filter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { computed } from '@ember/object';
22
import Component from '@ember/component';
3-
import sortBy from 'npm:lodash.sortby';
3+
import sortBy from 'lodash.sortby';
44

55
const filterDataComputedParams = 'filterData.{showInherited,showProtected,showPrivate,showDeprecated}';
66

@@ -43,9 +43,9 @@ export default Component.extend({
4343

4444
filteredData: computed('filteredMethods', 'filteredProperties', 'filteredEvents', function() {
4545
return {
46-
methods: this.get('filteredMethods'),
47-
properties: this.get('filteredProperties'),
48-
events: this.get('filteredEvents')
46+
methods: this.filteredMethods,
47+
properties: this.filteredProperties,
48+
events: this.filteredEvents
4949
};
5050
}),
5151

app/components/class-field-description.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default Component.extend({
77
legacyModuleMappings: service(),
88

99
hasImportExample: computed('field.{name,class}', function () {
10-
return this.get('legacyModuleMappings').hasFunctionMapping(this.get('field.name'), this.get('field.class'));
10+
return this.legacyModuleMappings.hasFunctionMapping(this.get('field.name'), this.get('field.class'));
1111
}),
1212

1313
stickyEnabled: gt('ownHeight', 200),

app/components/ember-anchor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default AnchorComponent.extend({
77

88
// This overrides Ember Anchor to support scrolling within a fixed position element
99
_scrollToElemPosition() {
10-
let qp = this.get('anchorQueryParam');
10+
let qp = this.anchorQueryParam;
1111
let qpVal = this.get(get(this, 'attrs.a') ? 'a' : `controller.${qp}`);
1212
let elem = $(`[data-${qp}="${qpVal}"]`);
1313
let offset = elem.offset() ? elem.offset().top : 0;

app/components/search-input.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default Component.extend({
3232
if (get(this, 'searchService.search.isRunning')) {
3333
return false;
3434
}
35-
return isPresent(get(this, 'query')) && isEmpty(get(this, 'searchService.results'));
35+
return isPresent(this.query) && isEmpty(get(this, 'searchService.results'));
3636
}),
3737

3838
search: task(function * (query) {
@@ -66,7 +66,7 @@ export default Component.extend({
6666
},
6767

6868
onblur() {
69-
this.get('closeMenu').perform();
69+
this.closeMenu.perform();
7070
}
7171

7272
}

app/components/search-input/dropdown-result.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default Component.extend({
2525
}),
2626
// Left sidebar should only be displayed for the first result in the group
2727
_primaryColumn: computed('groupPosition,groupName', function () {
28-
const { groupName, groupPosition } = this.getProperties('groupName', 'groupPosition');
28+
const { groupName, groupPosition } = this;
2929
return groupPosition === 0? groupName : '';
3030
}),
3131
isSecondary: gt('groupPosition', 0)

app/components/search-input/dropdown.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default Component.extend({
3232
return {};
3333
}
3434

35-
const lvl0Group = get(this, 'results').reduce((previous, current) => {
35+
const lvl0Group = this.results.reduce((previous, current) => {
3636
// Remap all lowercase usages of 'guides' to 'Guides'
3737
let lvl0 = get(current, 'hierarchy.lvl0');
3838
// If lvl0 doesn't exist in the resulting object, create the array

app/controllers/project-version.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { computed } from '@ember/object';
33
import { alias, readOnly } from '@ember/object/computed';
44
import { A } from '@ember/array';
55
import { inject as service } from '@ember/service';
6-
import values from 'npm:lodash.values';
7-
import groupBy from 'npm:lodash.groupby';
8-
import semverCompare from 'npm:semver-compare';
6+
import values from 'lodash.values';
7+
import groupBy from 'lodash.groupby';
8+
import semverCompare from 'semver-compare';
99
import getCompactVersion from '../utils/get-compact-version';
1010

1111
export default Controller.extend({
@@ -48,28 +48,28 @@ export default Controller.extend({
4848
},
4949

5050
getRelations(relationship) {
51-
return this.get('model').hasMany(relationship).ids().sort();
51+
return this.model.hasMany(relationship).ids().sort();
5252
},
5353

5454
getRelationshipIDs(relationship) {
5555
const splitPoint = 2 + this.get('model.project.id').split('-').length - 1;
56-
const classes = this.get('model').hasMany(relationship);
56+
const classes = this.model.hasMany(relationship);
5757
const sorted = A(classes.ids()).sort();
5858
//ids come in as ember-2.16.0-@ember/object/promise-proxy-mixin
5959
//so we take the string after the 2nd '-'
6060
return A(sorted).toArray().map(id => id.split('-').slice(splitPoint).join('-'));
6161
},
6262

6363
shownClassesIDs: computed('showPrivateClasses', 'classesIDs', 'publicClassesIDs', function() {
64-
return this.get('showPrivateClasses') ? this.get('classesIDs') : this.get('publicClassesIDs');
64+
return this.showPrivateClasses ? this.classesIDs : this.publicClassesIDs;
6565
}),
6666

6767
shownModuleIDs: computed('showPrivateClasses', 'moduleIDs', 'publicModuleIDs', function() {
68-
return this.get('showPrivateClasses') ? this.get('moduleIDs') : this.get('publicModuleIDs');
68+
return this.showPrivateClasses ? this.moduleIDs : this.publicModuleIDs;
6969
}),
7070

7171
shownNamespaceIDs: computed('showPrivateClasses', 'namespaceIDs', 'publicNamespaceIDs', function() {
72-
return this.get('showPrivateClasses') ? this.get('namespaceIDs') : this.get('publicNamespaceIDs');
72+
return this.showPrivateClasses ? this.namespaceIDs : this.publicNamespaceIDs;
7373
}),
7474

7575
projectVersions: computed('metaStore.availableProjectVersions', 'model.project.id', function() {
@@ -88,7 +88,7 @@ export default Controller.extend({
8888
urlVersion: alias('project.urlVersion'),
8989

9090
selectedProjectVersion:computed('projectVersions.[]', 'model.version', function() {
91-
return this.get('projectVersions').filter(pV => pV.id === this.get('model.version'))[0];
91+
return this.projectVersions.filter(pV => pV.id === this.get('model.version'))[0];
9292
}),
9393

9494
activeProject: readOnly('model.project.id')

app/controllers/project-version/classes/class.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ export default Controller.extend(ParentNameMixin, FilterParams, {
99
legacyModuleMappings: service(),
1010

1111
hasImportExample: computed('model.name', 'legacyModuleMappings.mappings', function () {
12-
return this.get('legacyModuleMappings').hasClassMapping(this.get('model.name'), this.get('model.module'));
12+
return this.legacyModuleMappings.hasClassMapping(this.get('model.name'), this.get('model.module'));
1313
}),
1414

1515
module: computed('model.name', 'legacyModulemappings.mappings', function () {
16-
return this.get('legacyModuleMappings').getModule(this.get('model.name'), this.get('model.module'));
16+
return this.legacyModuleMappings.getModule(this.get('model.name'), this.get('model.module'));
1717
}),
1818

1919
actions: {

app/controllers/project-version/modules/module.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { alias } from '@ember/object/computed';
22
import { computed } from '@ember/object';
33
import { inject as service } from '@ember/service';
44
import ClassController from '../classes/class';
5-
import uniq from 'npm:lodash.uniq';
6-
import union from 'npm:lodash.union';
5+
import uniq from 'lodash.uniq';
6+
import union from 'lodash.union';
77

88
export default ClassController.extend({
99
filterData: service(),
@@ -18,18 +18,18 @@ export default ClassController.extend({
1818
}),
1919

2020
classes: computed('model', 'showPrivateClasses', function() {
21-
if (this.get('showPrivateClasses')) {
21+
if (this.showPrivateClasses) {
2222
return this.get('model.publicclasses').concat(this.get('model.privateclasses'));
2323
}
2424
return this.get('model.publicclasses');
2525
}),
2626

2727
classesAndNamespaces: computed('classes', 'namespaces', function () {
28-
return uniq(union(this.get('namespaces'), this.get('classes')).sort(), true);
28+
return uniq(union(this.namespaces, this.classes).sort(), true);
2929
}),
3030

3131
functionHeadings: computed('model', 'showPrivateClasses', function () {
32-
if (this.get('model.allstaticfunctions') && this.get('showPrivateClasses')) {
32+
if (this.get('model.allstaticfunctions') && this.showPrivateClasses) {
3333
return Object.keys(this.get('model.allstaticfunctions')).sort();
3434
} else if (this.get('model.staticfunctions')) {
3535
return Object.keys(this.get('model.staticfunctions')).sort();
@@ -38,7 +38,7 @@ export default ClassController.extend({
3838
}),
3939

4040
functions: computed('model', 'showPrivateClasses', function () {
41-
if (this.get('showPrivateClasses') && this.get('model.allstaticfunctions')) {
41+
if (this.showPrivateClasses && this.get('model.allstaticfunctions')) {
4242
return this.get('model.allstaticfunctions');
4343
}
4444
return this.get('model.staticfunctions');

app/mixins/parent-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default Mixin.create({
88

99
routeName: readOnly('router.currentRouteName'),
1010
parentName: computed('routeName', function() {
11-
const routeName = this.get('routeName');
11+
const routeName = this.routeName;
1212
const routes = routeName.split('.');
1313
return routes.slice(0, 3).join('.');
1414
})

app/mixins/scroll-tracker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default Mixin.create({
99

1010
actions: {
1111
willTransition(transition) {
12-
this.get('scrollPositionReset').scheduleReset(transition);
12+
this.scrollPositionReset.scheduleReset(transition);
1313
},
1414

1515
didTransition() {
@@ -22,7 +22,7 @@ export default Mixin.create({
2222
return;
2323
}
2424
}
25-
this.get('scrollPositionReset').doReset();
25+
this.scrollPositionReset.doReset();
2626
}
2727
}
2828
});

app/models/class.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const projectNameFromClassName = key => {
2121
const guessVersionFor = key => {
2222
return computed(key, 'project.id', function() {
2323

24-
if (this.get('extendedClassProjectName') === this.get('project.id')) {
24+
if (this.extendedClassProjectName === this.get('project.id')) {
2525
return this.get('projectVersion.version');
2626
}
2727

@@ -46,7 +46,7 @@ export default DS.Model.extend({
4646
parentClass: belongsTo('class', {async: true, inverse: null}),
4747
projectVersion: belongsTo('project-version', {inverse: 'classes'}),
4848
project: computed('projectVersion.id', function() {
49-
return this.get('projectVersion').get('project');
49+
return this.projectVersion.get('project');
5050
}),
5151

5252
extendedClassProjectName: projectNameFromClassName('extends'),

app/models/project-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ export default DS.Model.extend({
1515
'private-namespaces': DS.hasMany('namespace', {async: true}),
1616
project: DS.belongsTo('project'),
1717
compactVersion: computed('version', function() {
18-
return getCompactVersion(this.get('version'));
18+
return getCompactVersion(this.version);
1919
})
2020
});

app/router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const AppRouter = Router.extend({
2121
}
2222

2323
scheduleOnce('afterRender', this, () => {
24-
const page = this.get('url');
24+
const page = this.url;
2525
const title = this.getWithDefault('currentRouteName', 'unknown');
2626

2727
// this is constant for this app and is only used to identify page views in the GA dashboard
2828
const hostname = config.APP.domain.replace(/(http|https)?:?\/\//g, '');
2929

30-
this.get('metrics').trackPage({ page, title, hostname });
30+
this.metrics.trackPage({ page, title, hostname });
3131
});
3232
}
3333
});

app/routes/application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default Route.extend({
2323
},
2424
async afterModel() {
2525
set(this, 'headData.cdnDomain', ENV.API_HOST);
26-
await this.get('legacyModuleMappings').initMappings();
26+
await this.legacyModuleMappings.initMappings();
2727
return this._super(...arguments);
2828
}
2929

0 commit comments

Comments
 (0)