From 752ffa545d8e8971f837c3e6b949473d2a249c2a Mon Sep 17 00:00:00 2001 From: Elad Shahar Date: Wed, 7 Oct 2015 21:22:08 -0400 Subject: [PATCH] Add service blueprint --- app/services/ember-cli.js | 4 ++++ app/templates/components/file-menu.hbs | 1 + ember-cli-build.js | 7 ++++--- tests/acceptance/gist-test.js | 26 ++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/services/ember-cli.js b/app/services/ember-cli.js index 29bf60b1..df9c027f 100644 --- a/app/services/ember-cli.js +++ b/app/services/ember-cli.js @@ -64,6 +64,10 @@ const availableBlueprints = { blueprint: 'route', filePath: 'my-route/route.js', }, + 'service': { + blueprint: 'service', + filePath: 'services/my-service.js' + }, 'template': { blueprint: 'template', filePath: 'my-route/template.hbs', diff --git a/app/templates/components/file-menu.hbs b/app/templates/components/file-menu.hbs index f0d3024e..999a5768 100644 --- a/app/templates/components/file-menu.hbs +++ b/app/templates/components/file-menu.hbs @@ -20,6 +20,7 @@
  • Controller
  • Route
  • Template
  • +
  • Service
  • Router
  • CSS
  • diff --git a/ember-cli-build.js b/ember-cli-build.js index fc27c779..cfe08781 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -85,12 +85,13 @@ function getEmberCLIBlueprints() { var cliPath = 'node_modules/ember-cli'; var cliBlueprintFiles = { 'app': 'app/files/app/app.js', - 'router': 'app/files/app/router.js', - 'component-js': 'component/files/__root__/__path__/__name__.js', 'component-hbs': 'component/files/__root__/__templatepath__/__templatename__.hbs', + 'component-js': 'component/files/__root__/__path__/__name__.js', + 'controller': 'controller/files/__root__/__path__/__name__.js', 'model': 'model/files/__root__/__path__/__name__.js', 'route': 'route/files/__root__/__path__/__name__.js', - 'controller': 'controller/files/__root__/__path__/__name__.js', + 'router': 'app/files/app/router.js', + 'service': 'service/files/__root__/__path__/__name__.js', 'template': 'template/files/__root__/__path__/__name__.hbs', }; diff --git a/tests/acceptance/gist-test.js b/tests/acceptance/gist-test.js index 163df145..f8d914f1 100644 --- a/tests/acceptance/gist-test.js +++ b/tests/acceptance/gist-test.js @@ -172,6 +172,32 @@ test('component without hyphen fails', function(assert){ }); }); +test('can add service', function(assert){ + assert.expect(3); + + let origFileCount; + promptValue = "services/my-service.js"; + visit('/'); + andThen(function(){ + origFileCount = find(firstFilePickerFiles).length; + }); + + click(fileMenu); + click('.add-service-link'); + click(firstFilePicker); + + andThen(function() { + let numFiles = find(firstFilePickerFiles).length; + assert.equal(numFiles, origFileCount + 1, 'Added service file'); + + let fileNames = findMapText(`${firstFilePickerFiles} a`); + assert.equal(fileNames[3], promptValue, 'Added the file with the right name'); + + let columnFiles = findMapText(displayedFiles); + assert.ok(columnFiles.contains(promptValue), 'Added file is displayed'); + }); +}); + test('unsaved indicator', function(assert) { const indicator = ".test-unsaved-indicator";