ember-source 4.5.0-beta.1 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/blueprints/-utils.js +9 -0
  3. package/blueprints/acceptance-test/index.js +3 -1
  4. package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.ts +1 -1
  5. package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.ts +1 -1
  6. package/blueprints/component-test/index.js +2 -0
  7. package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.ts +2 -2
  8. package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.ts +2 -2
  9. package/blueprints/controller-test/index.js +2 -0
  10. package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.ts +1 -1
  11. package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.ts +1 -1
  12. package/blueprints/helper-test/index.js +2 -3
  13. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.ts +1 -1
  14. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.ts +1 -1
  15. package/blueprints/route-test/index.js +2 -0
  16. package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.ts +1 -1
  17. package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.ts +1 -1
  18. package/blueprints/service-test/index.js +2 -0
  19. package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.ts +1 -1
  20. package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.ts +1 -1
  21. package/blueprints-js/-addon-import.js +48 -0
  22. package/blueprints-js/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +24 -0
  23. package/blueprints-js/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  24. package/blueprints-js/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +12 -0
  25. package/blueprints-js/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
  26. package/blueprints-js/component/files/__root__/__path__/__name__.js +3 -0
  27. package/blueprints-js/component/files/__root__/__templatepath__/__templatename__.hbs +1 -0
  28. package/blueprints-js/component-addon/files/__root__/__path__/__name__.js +1 -0
  29. package/blueprints-js/component-class/files/__root__/__path__/__name__.js +3 -0
  30. package/blueprints-js/component-class-addon/files/__root__/__path__/__name__.js +1 -0
  31. package/blueprints-js/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +34 -0
  32. package/blueprints-js/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +36 -0
  33. package/blueprints-js/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +38 -0
  34. package/blueprints-js/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +31 -0
  35. package/blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +36 -0
  36. package/blueprints-js/controller/files/__root__/__path__/__name__.js +3 -0
  37. package/blueprints-js/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  38. package/blueprints-js/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  39. package/blueprints-js/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  40. package/blueprints-js/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  41. package/blueprints-js/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  42. package/blueprints-js/helper/files/__root__/__collection__/__name__.js +5 -0
  43. package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +7 -0
  44. package/blueprints-js/helper-addon/files/__root__/__path__/__name__.js +1 -0
  45. package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +26 -0
  46. package/blueprints-js/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +28 -0
  47. package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +18 -0
  48. package/blueprints-js/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +15 -0
  49. package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +17 -0
  50. package/blueprints-js/initializer/files/__root__/initializers/__name__.js +5 -0
  51. package/blueprints-js/initializer-addon/files/__root__/__path__/__name__.js +1 -0
  52. package/blueprints-js/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +28 -0
  53. package/blueprints-js/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +31 -0
  54. package/blueprints-js/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +25 -0
  55. package/blueprints-js/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +37 -0
  56. package/blueprints-js/instance-initializer/files/__root__/instance-initializers/__name__.js +5 -0
  57. package/blueprints-js/instance-initializer-addon/files/__root__/__path__/__name__.js +1 -0
  58. package/blueprints-js/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +30 -0
  59. package/blueprints-js/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +32 -0
  60. package/blueprints-js/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +26 -0
  61. package/blueprints-js/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +39 -0
  62. package/blueprints-js/mixin/files/__root__/mixins/__name__.js +3 -0
  63. package/blueprints-js/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +13 -0
  64. package/blueprints-js/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +13 -0
  65. package/blueprints-js/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +12 -0
  66. package/blueprints-js/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +12 -0
  67. package/blueprints-js/route/files/__root__/__path__/__name__.js +9 -0
  68. package/blueprints-js/route/files/__root__/__templatepath__/__templatename__.hbs +2 -0
  69. package/blueprints-js/route-addon/files/__root__/__path__/__name__.js +1 -0
  70. package/blueprints-js/route-addon/files/__root__/__templatepath__/__templatename__.js +1 -0
  71. package/blueprints-js/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +15 -0
  72. package/blueprints-js/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +17 -0
  73. package/blueprints-js/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  74. package/blueprints-js/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +11 -0
  75. package/blueprints-js/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +11 -0
  76. package/blueprints-js/service/files/__root__/__path__/__name__.js +3 -0
  77. package/blueprints-js/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
  78. package/blueprints-js/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
  79. package/blueprints-js/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
  80. package/blueprints-js/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
  81. package/blueprints-js/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
  82. package/blueprints-js/template/files/__root__/__path__/__name__.hbs +0 -0
  83. package/blueprints-js/test-framework-detector.js +60 -0
  84. package/blueprints-js/util/files/__root__/utils/__name__.js +3 -0
  85. package/blueprints-js/util-test/mocha-files/__root__/__testType__/__name__-test.js +11 -0
  86. package/blueprints-js/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +11 -0
  87. package/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +10 -0
  88. package/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +10 -0
  89. package/build-metadata.json +3 -3
  90. package/dist/ember-template-compiler.js +2 -2
  91. package/dist/ember-template-compiler.map +1 -1
  92. package/dist/ember-testing.js +1 -1
  93. package/dist/ember-testing.map +1 -1
  94. package/dist/ember.debug.js +21 -8
  95. package/dist/ember.debug.map +1 -1
  96. package/dist/header/license.js +1 -1
  97. package/dist/packages/@ember/-internals/glimmer/index.js +19 -6
  98. package/dist/packages/ember/version.js +1 -1
  99. package/docs/data.json +18 -6
  100. package/package.json +5 -7
package/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  # Ember Changelog
2
2
 
3
- ### v4.5.0-beta.1 (May 2, 2022)
3
+ ### v4.5.1 (July 25, 2022)
4
+
5
+ - [#20120](https://github.com/emberjs/ember.js/pull/20120) [BUGFIX] Adjust uniqueId() implementation to only generate valid selectors.
6
+
7
+ ### v4.5.0 (June 13, 2022)
4
8
 
5
9
  - [#20052](https://github.com/emberjs/ember.js/pull/20052) / [#20055](https://github.com/emberjs/ember.js/pull/20055) [FEATURE] Add the default helper manager to implement [RFC #0756](https://github.com/emberjs/rfcs/blob/master/text/0756-helper-default-manager.md).
6
10
  - [#20053](https://github.com/emberjs/ember.js/pull/20053) [FEATURE] Expose `renderSettled` from `@ember/renderer` to enable implementation of [RFC #0785](https://github.com/emberjs/rfcs/blob/master/text/0785-remove-set-get-in-tests.md).
7
11
 
12
+ ### v4.4.2 (June 13, 2022)
13
+
14
+ - [#20114](https://github.com/emberjs/ember.js/pull/20114) [BUGFIX] Fix generated import paths for test setup functions in addons
15
+
16
+ ### v4.4.1 (May 31, 2022)
17
+
18
+ - [#20082](https://github.com/emberjs/ember.js/pull/20082) [BUGFIX] Fix blueprints publication
19
+
8
20
  ### v4.4.0 (May 2, 2022)
9
21
 
10
22
  - [#19882](https://github.com/emberjs/ember.js/pull/19882) / [#20005](https://github.com/emberjs/ember.js/pull/20005) [FEATURE] Implement the `unique-id` helper per [RFC #0659](https://github.com/emberjs/rfcs/blob/master/text/0659-unique-id-helper.md).
@@ -0,0 +1,9 @@
1
+ const { dasherize } = require('ember-cli-string-utils');
2
+
3
+ function modulePrefixForProject(project) {
4
+ return dasherize(project.config().modulePrefix);
5
+ }
6
+
7
+ module.exports = {
8
+ modulePrefixForProject,
9
+ };
@@ -6,6 +6,7 @@ const pathUtil = require('ember-cli-path-utils');
6
6
  const stringUtils = require('ember-cli-string-utils');
7
7
 
8
8
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
9
+ const { modulePrefixForProject } = require('../-utils');
9
10
  const useTestFrameworkDetector = require('../test-framework-detector');
10
11
 
11
12
  module.exports = useTestFrameworkDetector({
@@ -35,7 +36,8 @@ module.exports = useTestFrameworkDetector({
35
36
  ].join(' | ');
36
37
 
37
38
  return {
38
- testFolderRoot: testFolderRoot,
39
+ modulePrefix: modulePrefixForProject(options.project),
40
+ testFolderRoot,
39
41
  friendlyTestName,
40
42
  destroyAppExists,
41
43
  };
@@ -1,6 +1,6 @@
1
1
  import { describe, it } from 'mocha';
2
2
  import { expect } from 'chai';
3
- import { setupApplicationTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupApplicationTest } from '<%= modulePrefix %>/tests/helpers';
4
4
  import { visit, currentURL } from '@ember/test-helpers';
5
5
 
6
6
  describe('<%= friendlyTestName %>', function () {
@@ -1,6 +1,6 @@
1
1
  import { module, test } from 'qunit';
2
2
  import { visit, currentURL } from '@ember/test-helpers';
3
- import { setupApplicationTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupApplicationTest } from '<%= modulePrefix %>/tests/helpers';
4
4
 
5
5
  module('<%= friendlyTestName %>', function (hooks) {
6
6
  setupApplicationTest(hooks);
@@ -7,6 +7,7 @@ const getPathOption = require('ember-cli-get-component-path-option');
7
7
  const semver = require('semver');
8
8
 
9
9
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
10
+ const { modulePrefixForProject } = require('../-utils');
10
11
  const useTestFrameworkDetector = require('../test-framework-detector');
11
12
 
12
13
  function invocationFor(options) {
@@ -81,6 +82,7 @@ module.exports = useTestFrameworkDetector({
81
82
  let selfCloseComponent = (descriptor) => `<${descriptor} />`;
82
83
 
83
84
  return {
85
+ modulePrefix: modulePrefixForProject(options.project),
84
86
  path: getPathOption(options),
85
87
  testType: testType,
86
88
  componentName,
@@ -1,6 +1,6 @@
1
1
  <% if (testType === 'integration') { %>import { expect } from 'chai';
2
2
  import { describe, it } from 'mocha';
3
- import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
4
4
  import { render } from '@ember/test-helpers';
5
5
  <%= hbsImportStatement %>
6
6
 
@@ -26,7 +26,7 @@ describe('<%= friendlyTestDescription %>', function () {
26
26
  });
27
27
  });<% } else if (testType === 'unit') { %>import { expect } from 'chai';
28
28
  import { describe, it } from 'mocha';
29
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
29
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
30
30
 
31
31
  describe('<%= friendlyTestDescription %>', function () {
32
32
  setupTest();
@@ -1,5 +1,5 @@
1
1
  <% if (testType === 'integration') { %>import { module, test } from 'qunit';
2
- import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
2
+ import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
3
3
  import { render } from '@ember/test-helpers';
4
4
  <%= hbsImportStatement %>
5
5
 
@@ -24,7 +24,7 @@ module('<%= friendlyTestDescription %>', function (hooks) {
24
24
  assert.dom(this.element).hasText('template block text');
25
25
  });
26
26
  });<% } else if (testType === 'unit') { %>import { module, test } from 'qunit';
27
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
27
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
28
28
 
29
29
  module('<%= friendlyTestDescription %>', function (hooks) {
30
30
  setupTest(hooks);
@@ -6,6 +6,7 @@ const useTestFrameworkDetector = require('../test-framework-detector');
6
6
  const path = require('path');
7
7
 
8
8
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
9
+ const { modulePrefixForProject } = require('../-utils');
9
10
 
10
11
  module.exports = useTestFrameworkDetector({
11
12
  description: 'Generates a controller unit test.',
@@ -22,6 +23,7 @@ module.exports = useTestFrameworkDetector({
22
23
  let controllerPathName = dasherizedModuleName;
23
24
 
24
25
  return {
26
+ modulePrefix: modulePrefixForProject(options.project),
25
27
  controllerPathName: controllerPathName,
26
28
  friendlyTestDescription: ['Unit', 'Controller', dasherizedModuleName].join(' | '),
27
29
  };
@@ -1,6 +1,6 @@
1
1
  import { expect } from 'chai';
2
2
  import { describe, it } from 'mocha';
3
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
4
4
 
5
5
  describe('<%= friendlyTestDescription %>', function () {
6
6
  setupTest();
@@ -1,5 +1,5 @@
1
1
  import { module, test } from 'qunit';
2
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
2
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
3
3
 
4
4
  module('<%= friendlyTestDescription %>', function (hooks) {
5
5
  setupTest(hooks);
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const stringUtils = require('ember-cli-string-utils');
4
3
  const isPackageMissing = require('ember-cli-is-package-missing');
5
4
  const semver = require('semver');
6
5
 
7
6
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
7
+ const { modulePrefixForProject } = require('../-utils');
8
8
 
9
9
  const useTestFrameworkDetector = require('../test-framework-detector');
10
10
 
@@ -34,15 +34,14 @@ module.exports = useTestFrameworkDetector({
34
34
 
35
35
  locals: function (options) {
36
36
  let friendlyTestName = ['Integration', 'Helper', options.entity.name].join(' | ');
37
- let dasherizedModulePrefix = stringUtils.dasherize(options.project.config().modulePrefix);
38
37
 
39
38
  let hbsImportStatement = this._useNamedHbsImport()
40
39
  ? "import { hbs } from 'ember-cli-htmlbars';"
41
40
  : "import hbs from 'htmlbars-inline-precompile';";
42
41
 
43
42
  return {
43
+ modulePrefix: modulePrefixForProject(options.project),
44
44
  friendlyTestName,
45
- dasherizedModulePrefix,
46
45
  hbsImportStatement,
47
46
  };
48
47
  },
@@ -1,6 +1,6 @@
1
1
  import { expect } from 'chai';
2
2
  import { describe, it } from 'mocha';
3
- import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
4
4
  import { render } from '@ember/test-helpers';
5
5
  <%= hbsImportStatement %>
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { module, test } from 'qunit';
2
- import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
2
+ import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
3
3
  import { render } from '@ember/test-helpers';
4
4
  <%= hbsImportStatement %>
5
5
 
@@ -5,6 +5,7 @@ const stringUtil = require('ember-cli-string-utils');
5
5
 
6
6
  const useTestFrameworkDetector = require('../test-framework-detector');
7
7
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
8
+ const { modulePrefixForProject } = require('../-utils');
8
9
 
9
10
  module.exports = useTestFrameworkDetector({
10
11
  description: 'Generates a route unit test.',
@@ -57,6 +58,7 @@ module.exports = useTestFrameworkDetector({
57
58
  }
58
59
 
59
60
  return {
61
+ modulePrefix: modulePrefixForProject(options.project),
60
62
  friendlyTestDescription: ['Unit', 'Route', options.entity.name].join(' | '),
61
63
  moduleName: stringUtil.dasherize(moduleName),
62
64
  };
@@ -1,6 +1,6 @@
1
1
  import { expect } from 'chai';
2
2
  import { describe, it } from 'mocha';
3
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
4
4
 
5
5
  describe('<%= friendlyTestDescription %>', function () {
6
6
  setupTest();
@@ -1,5 +1,5 @@
1
1
  import { module, test } from 'qunit';
2
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
2
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
3
3
 
4
4
  module('<%= friendlyTestDescription %>', function (hooks) {
5
5
  setupTest(hooks);
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints');
4
+ const { modulePrefixForProject } = require('../-utils');
4
5
  const useTestFrameworkDetector = require('../test-framework-detector');
5
6
 
6
7
  module.exports = useTestFrameworkDetector({
@@ -26,6 +27,7 @@ module.exports = useTestFrameworkDetector({
26
27
 
27
28
  locals(options) {
28
29
  return {
30
+ modulePrefix: modulePrefixForProject(options.project),
29
31
  friendlyTestDescription: ['Unit', 'Service', options.entity.name].join(' | '),
30
32
  };
31
33
  },
@@ -1,6 +1,6 @@
1
1
  import { expect } from 'chai';
2
2
  import { describe, it } from 'mocha';
3
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
3
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
4
4
 
5
5
  describe('<%= friendlyTestDescription %>', function () {
6
6
  setupTest();
@@ -1,5 +1,5 @@
1
1
  import { module, test } from 'qunit';
2
- import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';
2
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
3
3
 
4
4
  module('<%= friendlyTestDescription %>', function (hooks) {
5
5
  setupTest(hooks);
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ const stringUtil = require('ember-cli-string-utils');
4
+ const path = require('path');
5
+ const inflector = require('inflection');
6
+
7
+ module.exports = {
8
+ description: 'Generates an import wrapper.',
9
+
10
+ fileMapTokens: function () {
11
+ return {
12
+ __name__: function (options) {
13
+ return options.dasherizedModuleName;
14
+ },
15
+ __path__: function (options) {
16
+ return inflector.pluralize(options.locals.blueprintName);
17
+ },
18
+ __root__: function (options) {
19
+ if (options.inRepoAddon) {
20
+ return path.join('lib', options.inRepoAddon, 'app');
21
+ }
22
+ return 'app';
23
+ },
24
+ };
25
+ },
26
+
27
+ locals: function (options) {
28
+ let addonRawName = options.inRepoAddon ? options.inRepoAddon : options.project.name();
29
+ let addonName = stringUtil.dasherize(addonRawName);
30
+ let fileName = stringUtil.dasherize(options.entity.name);
31
+ let blueprintName = options.originBlueprintName;
32
+ let modulePathSegments = [
33
+ addonName,
34
+ inflector.pluralize(options.originBlueprintName),
35
+ fileName,
36
+ ];
37
+
38
+ if (blueprintName.match(/-addon/)) {
39
+ blueprintName = blueprintName.substr(0, blueprintName.indexOf('-addon'));
40
+ modulePathSegments = [addonName, inflector.pluralize(blueprintName), fileName];
41
+ }
42
+
43
+ return {
44
+ modulePath: modulePathSegments.join('/'),
45
+ blueprintName: blueprintName,
46
+ };
47
+ },
48
+ };
@@ -0,0 +1,24 @@
1
+ import { describe, it, beforeEach, afterEach } from 'mocha';
2
+ import { expect } from 'chai';
3
+ import startApp from '<%= dasherizedPackageName %>/tests/helpers/start-app';
4
+ <% if (destroyAppExists) { %>import destroyApp from '<%= dasherizedPackageName %>/tests/helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop';<% } %>
5
+
6
+ describe('<%= friendlyTestName %>', function () {
7
+ let application;
8
+
9
+ beforeEach(function () {
10
+ application = startApp();
11
+ });
12
+
13
+ afterEach(function () {
14
+ <% if (destroyAppExists) { %>destroyApp(application);<% } else { %>run(application, 'destroy');<% } %>
15
+ });
16
+
17
+ it('can visit /<%= dasherizedModuleName %>', function () {
18
+ visit('/<%= dasherizedModuleName %>');
19
+
20
+ return andThen(() => {
21
+ expect(currentURL()).to.equal('/<%= dasherizedModuleName %>');
22
+ });
23
+ });
24
+ });
@@ -0,0 +1,13 @@
1
+ import { describe, it } from 'mocha';
2
+ import { expect } from 'chai';
3
+ import { setupApplicationTest } from '<%= modulePrefix %>/tests/helpers';
4
+ import { visit, currentURL } from '@ember/test-helpers';
5
+
6
+ describe('<%= friendlyTestName %>', function () {
7
+ setupApplicationTest();
8
+
9
+ it('can visit /<%= dasherizedModuleName %>', async function () {
10
+ await visit('/<%= dasherizedModuleName %>');
11
+ expect(currentURL()).to.equal('/<%= dasherizedModuleName %>');
12
+ });
13
+ });
@@ -0,0 +1,12 @@
1
+ import { test } from 'qunit';
2
+ import moduleForAcceptance from '<%= testFolderRoot %>/tests/helpers/module-for-acceptance';
3
+
4
+ moduleForAcceptance('<%= friendlyTestName %>');
5
+
6
+ test('visiting /<%= dasherizedModuleName %>', function (assert) {
7
+ visit('/<%= dasherizedModuleName %>');
8
+
9
+ andThen(function () {
10
+ assert.strictEqual(currentURL(), '/<%= dasherizedModuleName %>');
11
+ });
12
+ });
@@ -0,0 +1,13 @@
1
+ import { module, test } from 'qunit';
2
+ import { visit, currentURL } from '@ember/test-helpers';
3
+ import { setupApplicationTest } from '<%= modulePrefix %>/tests/helpers';
4
+
5
+ module('<%= friendlyTestName %>', function (hooks) {
6
+ setupApplicationTest(hooks);
7
+
8
+ test('visiting /<%= dasherizedModuleName %>', async function (assert) {
9
+ await visit('/<%= dasherizedModuleName %>');
10
+
11
+ assert.strictEqual(currentURL(), '/<%= dasherizedModuleName %>');
12
+ });
13
+ });
@@ -0,0 +1,3 @@
1
+ <%= importComponent %>
2
+ <%= importTemplate %>
3
+ export default <%= defaultExport %>
@@ -0,0 +1 @@
1
+ export { default } from '<%= modulePath %>';
@@ -0,0 +1,3 @@
1
+ <%= importComponent %>
2
+ <%= importTemplate %>
3
+ export default <%= defaultExport %>
@@ -0,0 +1 @@
1
+ export { default } from '<%= modulePath %>';
@@ -0,0 +1,34 @@
1
+ import { expect } from 'chai';
2
+ import { describe, it } from 'mocha';
3
+ import { setupComponentTest } from 'ember-mocha';<% if (testType === 'integration') { %>
4
+ import hbs from 'htmlbars-inline-precompile';<% } %>
5
+
6
+ describe('<%= friendlyTestDescription %>', function () {
7
+ setupComponentTest('<%= componentPathName %>', {
8
+ <% if (testType === 'integration' ) { %>integration: true,<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
9
+ // needs: ['component:foo', 'helper:bar'],
10
+ unit: true,<% } %>
11
+ });
12
+
13
+ it('renders', function () {
14
+ <% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value');
15
+ // Handle any actions with this.on('myAction', function(val) { ... });
16
+
17
+ this.render(hbs`<%= selfCloseComponent(componentName) %>`);
18
+ expect(this.$()).to.have.length(1);
19
+
20
+ // Template block usage:
21
+ this.render(hbs`
22
+ <%= openComponent(componentName) %>
23
+ template block text
24
+ <%= closeComponent(componentName) %>
25
+ `);
26
+
27
+ expect(this.$().text().trim()).to.equal('template block text');<% } else if(testType === 'unit') { %>// creates the component instance
28
+ let component = this.subject();
29
+ // renders the component on the page
30
+ this.render();
31
+ expect(component).to.be.ok;
32
+ expect(this.$()).to.have.length(1);<% } %>
33
+ });
34
+ });
@@ -0,0 +1,36 @@
1
+ import { expect } from 'chai';
2
+ import { describeComponent, it } from 'ember-mocha';<% if (testType === 'integration') { %>
3
+ import hbs from 'htmlbars-inline-precompile';<% } %>
4
+
5
+ describeComponent(
6
+ '<%= componentPathName %>',
7
+ '<%= friendlyTestDescription %>',
8
+ {
9
+ <% if (testType === 'integration' ) { %>integration: true,<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
10
+ // needs: ['component:foo', 'helper:bar'],
11
+ unit: true,<% } %>
12
+ },
13
+ function () {
14
+ it('renders', function () {
15
+ <% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value');
16
+ // Handle any actions with this.on('myAction', function(val) { ... });
17
+
18
+ this.render(hbs`<%= selfCloseComponent(componentName) %>`);
19
+ expect(this.$()).to.have.length(1);
20
+
21
+ // Template block usage:
22
+ this.render(hbs`
23
+ <%= openComponent(componentName) %>
24
+ template block text
25
+ <%= closeComponent(componentName) %>
26
+ `);
27
+
28
+ expect(this.$().text().trim()).to.equal('template block text');<% } else if(testType === 'unit') { %>// creates the component instance
29
+ let component = this.subject();
30
+ // renders the component on the page
31
+ this.render();
32
+ expect(component).to.be.ok;
33
+ expect(this.$()).to.have.length(1);<% } %>
34
+ });
35
+ }
36
+ );
@@ -0,0 +1,38 @@
1
+ <% if (testType === 'integration') { %>import { expect } from 'chai';
2
+ import { describe, it } from 'mocha';
3
+ import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
4
+ import { render } from '@ember/test-helpers';
5
+ <%= hbsImportStatement %>
6
+
7
+ describe('<%= friendlyTestDescription %>', function () {
8
+ setupRenderingTest();
9
+
10
+ it('renders', async function () {
11
+ // Set any properties with this.set('myProperty', 'value');
12
+ // Handle any actions with this.set('myAction', function(val) { ... });
13
+
14
+ await render(hbs`<%= selfCloseComponent(componentName) %>`);
15
+
16
+ expect(this.element.textContent.trim()).to.equal('');
17
+
18
+ // Template block usage:
19
+ await render(hbs`
20
+ <%= openComponent(componentName) %>
21
+ template block text
22
+ <%= closeComponent(componentName) %>
23
+ `);
24
+
25
+ expect(this.element.textContent.trim()).to.equal('template block text');
26
+ });
27
+ });<% } else if (testType === 'unit') { %>import { expect } from 'chai';
28
+ import { describe, it } from 'mocha';
29
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
30
+
31
+ describe('<%= friendlyTestDescription %>', function () {
32
+ setupTest();
33
+
34
+ it('exists', function () {
35
+ let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
36
+ expect(component).to.be.ok;
37
+ });
38
+ });<% } %>
@@ -0,0 +1,31 @@
1
+ import { moduleForComponent, test } from 'ember-qunit';<% if (testType === 'integration') { %>
2
+ import hbs from 'htmlbars-inline-precompile';<% } %>
3
+
4
+ moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', {
5
+ <% if (testType === 'integration' ) { %>integration: true,<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test
6
+ // needs: ['component:foo', 'helper:bar'],
7
+ unit: true,<% } %>
8
+ });
9
+
10
+ test('it renders', function (assert) {<% if (testType === 'integration' ) { %>
11
+ // Set any properties with this.set('myProperty', 'value');
12
+ // Handle any actions with this.on('myAction', function(val) { ... });
13
+
14
+ this.render(hbs`<%= selfCloseComponent(componentName) %>`);
15
+
16
+ assert.strictEqual(this.$().text().trim(), '');
17
+
18
+ // Template block usage:
19
+ this.render(hbs`
20
+ <%= openComponent(componentName) %>
21
+ template block text
22
+ <%= closeComponent(componentName) %>
23
+ `);
24
+
25
+ assert.strictEqual(this.$().text().trim(), 'template block text');<% } else if(testType === 'unit') { %>
26
+ // Creates the component instance
27
+ /*let component =*/ this.subject();
28
+ // Renders the component to the page
29
+ this.render();
30
+ assert.strictEqual(this.$().text().trim(), '');<% } %>
31
+ });
@@ -0,0 +1,36 @@
1
+ <% if (testType === 'integration') { %>import { module, test } from 'qunit';
2
+ import { setupRenderingTest } from '<%= modulePrefix %>/tests/helpers';
3
+ import { render } from '@ember/test-helpers';
4
+ <%= hbsImportStatement %>
5
+
6
+ module('<%= friendlyTestDescription %>', function (hooks) {
7
+ setupRenderingTest(hooks);
8
+
9
+ test('it renders', async function (assert) {
10
+ // Set any properties with this.set('myProperty', 'value');
11
+ // Handle any actions with this.set('myAction', function(val) { ... });
12
+
13
+ await render(hbs`<%= selfCloseComponent(componentName) %>`);
14
+
15
+ assert.dom(this.element).hasText('');
16
+
17
+ // Template block usage:
18
+ await render(hbs`
19
+ <%= openComponent(componentName) %>
20
+ template block text
21
+ <%= closeComponent(componentName) %>
22
+ `);
23
+
24
+ assert.dom(this.element).hasText('template block text');
25
+ });
26
+ });<% } else if (testType === 'unit') { %>import { module, test } from 'qunit';
27
+ import { setupTest } from '<%= modulePrefix %>/tests/helpers';
28
+
29
+ module('<%= friendlyTestDescription %>', function (hooks) {
30
+ setupTest(hooks);
31
+
32
+ test('it exists', function (assert) {
33
+ let component = this.owner.factoryFor('component:<%= componentPathName %>').create();
34
+ assert.ok(component);
35
+ });
36
+ });<% } %>
@@ -0,0 +1,3 @@
1
+ import Controller from '@ember/controller';
2
+
3
+ export default class <%= classifiedModuleName %>Controller extends Controller {}
@@ -0,0 +1,16 @@
1
+ import { expect } from 'chai';
2
+ import { describe, it } from 'mocha';
3
+ import { setupTest } from 'ember-mocha';
4
+
5
+ describe('<%= friendlyTestDescription %>', function () {
6
+ setupTest('controller:<%= dasherizedModuleName %>', {
7
+ // Specify the other units that are required for this test.
8
+ // needs: ['controller:foo']
9
+ });
10
+
11
+ // TODO: Replace this with your real tests.
12
+ it('exists', function () {
13
+ let controller = this.subject();
14
+ expect(controller).to.be.ok;
15
+ });
16
+ });
@@ -0,0 +1,18 @@
1
+ import { expect } from 'chai';
2
+ import { describeModule, it } from 'ember-mocha';
3
+
4
+ describeModule(
5
+ 'controller:<%= dasherizedModuleName %>',
6
+ '<%= friendlyTestDescription %>',
7
+ {
8
+ // Specify the other units that are required for this test.
9
+ // needs: ['controller:foo']
10
+ },
11
+ function () {
12
+ // TODO: Replace this with your real tests.
13
+ it('exists', function () {
14
+ let controller = this.subject();
15
+ expect(controller).to.be.ok;
16
+ });
17
+ }
18
+ );