Skip to content

Commit

Permalink
Merge pull request #2353 from simplabs/fix-ember-4
Browse files Browse the repository at this point in the history
Fix ember-release + ember-beta build
  • Loading branch information
BobrImperator authored May 26, 2022
2 parents 14ebcae + 0f3c675 commit b120bc4
Show file tree
Hide file tree
Showing 30 changed files with 861 additions and 831 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
- test:one ember-lts-3.16
- test:one ember-lts-3.20
- test:one ember-lts-3.24
- test:one ember-lts-3.28
- test:one ember-4.0
- test:one ember-lts-4.4
allow-failure: [false]
include:
- workspace: ember-simple-auth
Expand Down
3 changes: 3 additions & 0 deletions packages/classic-test-app/app/routes/auth-error.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* eslint-disable ember/no-mixins */
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Route.extend(AuthenticatedRouteMixin, {
store: service(),

model() {
return this.get('store').find('post', 3);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/classic-test-app/app/routes/protected.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* eslint-disable ember/no-mixins */
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Route.extend(AuthenticatedRouteMixin, {
store: service(),

model() {
return this.get('store').findAll('post');
}
Expand Down
3 changes: 3 additions & 0 deletions packages/classic-test-app/app/serializers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import JSONAPISerializer from '@ember-data/serializer/json-api';

export default JSONAPISerializer.extend();
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
{{#if errorMessage}}
{{#if this.errorMessage}}
<div class="alert alert-danger" data-test-error-message>
<p>
<strong>Login failed:</strong> <code>{{errorMessage}}</code>
<strong>Login failed:</strong> <code>{{this.errorMessage}}</code>
</p>
<p>
Documentation of the error codes can be found in the <a href="http://tools.ietf.org/html/rfc6749#section-5.2" title="RFC 6749 - Error Response">Error Response section of RFC 6749</a>.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
{{#link-to 'index' classNames='navbar-brand'}}
{{#link-to route='index' classNames='navbar-brand'}}
Home
{{/link-to}}
<ul class="navbar-nav mr-auto">
{{#link-to 'protected' tagName='li' class='nav-item'}}
{{#link-to route='protected' tagName='li' class='nav-item'}}
<a class="nav-link" href="#">Protected Page</a>
{{/link-to}}
{{#link-to 'engine.index' tagName='li'}}
{{#link-to route='engine.index' tagName='li'}}
<a class="nav-link" href="#">Engine</a>
{{/link-to}}
{{#link-to 'auth-error' tagName='li' class='nav-item'}}
{{#link-to route='auth-error' tagName='li' class='nav-item'}}
<a class="nav-link" href="#">Auth Error Page</a>
{{/link-to}}
</ul>
<form class="form-inline">
{{! display logout button when the session is authenticated, login button otherwise }}
{{#if session.isAuthenticated}}
{{#if sessionAccount.account}}
<span class="navbar-text mr-3">Signed in as {{sessionAccount.account.name}}</span>
{{#if this.session.isAuthenticated}}
{{#if this.sessionAccount.account}}
<span class="navbar-text mr-3">Signed in as {{this.sessionAccount.account.name}}</span>
{{/if}}
<a {{action 'logout'}} class="btn btn-danger" href="#" role="button">Logout</a>
{{else}}
<a {{action onLogin}} class="btn btn-success" href="#" role="button">Login</a>
<a {{action this.onLogin}} class="btn btn-success" href="#" role="button">Login</a>
{{/if}}
</form>
</nav>
6 changes: 3 additions & 3 deletions packages/classic-test-app/app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<h1>Ember Simple Auth example app</h1>
{{#unless session.isAuthenticated}}
{{#unless this.session.isAuthenticated}}
<div class="alert alert-info" role="alert">
You can {{#link-to 'login' classNames='alert-link'}}log in{{/link-to}} with login <code>letme</code> and password <code>in</code>.
You can {{#link-to route='login' classNames='alert-link'}}log in{{/link-to}} with login <code>letme</code> and password <code>in</code>.
</div>
{{/unless}}
<div class="alert alert-info" role="alert">
The test app provides two routes - the {{#link-to 'protected'}}Protected Page{{/link-to}} that loads some Ember Data models where the API validates that the request is authorized and the {{#link-to 'auth-error'}}Auth Error Page{{/link-to}} that simulates an authorization error (it loads Ember Data models as well but will always receive a 401 response) and will result in the session being invalidated.
The test app provides two routes - the {{#link-to route='protected'}}Protected Page{{/link-to}} that loads some Ember Data models where the API validates that the request is authorized and the {{#link-to route='auth-error'}}Auth Error Page{{/link-to}} that simulates an authorization error (it loads Ember Data models as well but will always receive a 401 response) and will result in the session being invalidated.
</div>
2 changes: 1 addition & 1 deletion packages/classic-test-app/app/templates/protected.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
<h2>Posts</h2>
<ul>
{{#each model as |post|}}
{{#each this.model as |post|}}
<li>
<h3>{{post.title}}</h3>
<p>{{post.body}}</p>
Expand Down
2 changes: 1 addition & 1 deletion packages/classic-test-app/config/optional-features.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"application-template-wrapper": false,
"default-async-observers": true,
"jquery-integration": true,
"jquery-integration": false,
"template-only-glimmer-components": true
}
7 changes: 5 additions & 2 deletions packages/classic-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"ember-cli-uglify": "^3.0.0",
"ember-data": "~3.17.0",
"ember-disable-prototype-extensions": "^1.1.2",
"ember-engines": "^0.8.5",
"ember-engines": "^0.8.22",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.0.1",
"ember-load-initializers": "^2.1.1",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-resolver": "^8.0.0",
"ember-simple-auth": "4.2.2",
"ember-qunit": "^4.6.0",
"ember-source": "~3.17.0",
"ember-source": "~3.24.0",
"ember-source-channel-url": "^3.0.0",
"ember-try": "^1.1.0",
"eslint": "^8.14.0",
Expand All @@ -69,5 +69,8 @@
"@babel/plugin-transform-typescript": "~7.17.0",
"cssstyle": "~2.3.0",
"jsdom": "^19.0.0"
},
"ember": {
"edition": "octane"
}
}
11 changes: 0 additions & 11 deletions packages/classic-test-app/tests/acceptance/authentication-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
fillIn,
click
} from '@ember/test-helpers';
import hasEmberVersion from 'ember-test-helpers/has-ember-version';
import Pretender from 'pretender';
import {
invalidateSession,
Expand Down Expand Up @@ -56,11 +55,6 @@ module('Acceptance: Authentication', function(hooks) {
});

module('the protected route', function() {
if (!hasEmberVersion(2, 4)) {
// guard against running test module on unsupported version (before 2.4)
return;
}

test('cannot be visited when the session is not authenticated', async function(assert) {
await invalidateSession();
await visit('/protected');
Expand Down Expand Up @@ -118,11 +112,6 @@ module('Acceptance: Authentication', function(hooks) {
});

module('the login route', function() {
if (!hasEmberVersion(2, 4)) {
// guard against running test module on unsupported version (before 2.4)
return;
}

test('can be visited when the session is not authenticated', async function(assert) {
await invalidateSession();
await visit('/login');
Expand Down
7 changes: 7 additions & 0 deletions packages/classic-test-app/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
{{content-for "body"}}
{{content-for "test-body"}}

<div id="qunit"></div>
<div id="qunit-fixture">
<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
</div>

<script src="/testem.js" integrity=""></script>
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/test-support.js"></script>
Expand Down
95 changes: 95 additions & 0 deletions packages/ember-simple-auth/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,74 @@ module.exports = function() {
},
},
},
{
name: 'ember-lts-3.28',
bower: {
dependencies: {
ember: null,
'ember-cli-shims': null,
'ember-data': null,
},
},
npm: {
devDependencies: {
'ember-cli': '~3.28.0',
'ember-data': '~3.28.0',
'ember-source': '~3.28.0',
torii: null,
},
},
},
{
name: 'ember-4.0',
bower: {
dependencies: {
ember: null,
'ember-cli-shims': null,
'ember-data': null,
},
},
npm: {
devDependencies: {
'ember-cli': '~3.28.0',
'ember-data': '~4.0.0',
'ember-source': '~4.0.0',
'ember-auto-import': '^2.2.3',
webpack: '^5.0.0',
'@ember/test-helpers': '^2.4.2',
'ember-qunit': '^5.1.4',
qunit: '^2.17.2',
torii: null,
'ember-cli-app-version': '~5.0.0',
'@ember/legacy-built-in-components': "~0.4.0",
},
},
},
{
name: 'ember-lts-4.4',
bower: {
dependencies: {
ember: null,
'ember-cli-shims': null,
'ember-data': null,
},
},
npm: {
devDependencies: {
'ember-cli': '~3.28.0',
'ember-data': '~4.4.0',
'ember-source': '~4.4.0',
'ember-auto-import': '^2.2.3',
webpack: '^5.0.0',
'@ember/test-helpers': '^2.4.2',
'ember-qunit': '^5.1.4',
qunit: '^2.17.2',
torii: null,
'ember-cli-app-version': '~5.0.0',
'@ember/legacy-built-in-components': "~0.4.0",
},
},
},
{
name: 'ember-release',
bower: {
Expand All @@ -86,8 +154,17 @@ module.exports = function() {
},
npm: {
devDependencies: {
'ember-cli': 'latest',
'ember-data': 'latest',
'ember-source': releaseUrl,
'ember-auto-import': '^2.2.3',
webpack: '^5.0.0',
'@ember/test-helpers': '^2.4.2',
'ember-qunit': '^5.1.4',
qunit: '^2.17.2',
'ember-cli-app-version': '~5.0.0',
'@ember/legacy-built-in-components': "~0.4.0",
torii: null,
},
},
},
Expand All @@ -100,8 +177,17 @@ module.exports = function() {
},
npm: {
devDependencies: {
'ember-cli': 'beta',
'ember-data': 'beta',
'ember-source': betaUrl,
'ember-auto-import': '^2.2.3',
webpack: '^5.0.0',
'@ember/test-helpers': '^2.4.2',
'ember-qunit': '^5.1.4',
qunit: '^2.17.2',
'ember-cli-app-version': '~5.0.0',
'@ember/legacy-built-in-components': "~0.4.0",
torii: null,
},
},
},
Expand All @@ -114,8 +200,17 @@ module.exports = function() {
},
npm: {
devDependencies: {
'ember-cli': 'beta',
'ember-data': 'canary',
'ember-source': canaryUrl,
'ember-auto-import': '^2.2.3',
webpack: '^5.0.0',
'@ember/test-helpers': '^2.4.2',
'ember-qunit': '^5.1.4',
qunit: '^2.17.2',
'ember-cli-app-version': '~5.0.0',
'@ember/legacy-built-in-components': "~0.4.0",
torii: null,
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions packages/ember-simple-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"dependencies": {
"base-64": "^1.0.0",
"broccoli-file-creator": "^2.1.1",
"broccoli-merge-trees": "^4.0.0",
"broccoli-funnel": "^3.0.0",
"broccoli-merge-trees": "^4.0.0",
"ember-cli-babel": "^7.20.5",
"ember-cli-is-package-missing": "^1.0.0",
"ember-cookies": "^0.5.0",
Expand All @@ -51,16 +51,15 @@
"ember-cli-uglify": "^3.0.0",
"ember-cli-yuidoc": "^0.9.1",
"ember-data": "~3.18.0",
"ember-debug-handlers-polyfill": "^1.1.0",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.0.1",
"ember-load-initializers": "^2.1.1",
"ember-maybe-import-regenerator": "^1.0.0",
"ember-qunit": "^4.6.0",
"ember-resolver": "^8.0.0",
"ember-sinon": "~5.0.0",
"ember-qunit": "^4.6.0",
"ember-source": "~3.18.0",
"ember-source": "~3.24.0",
"ember-source-channel-url": "^3.0.0",
"ember-test-selectors": "^6.0.0",
"ember-try": "^1.4.0",
Expand Down Expand Up @@ -94,5 +93,8 @@
},
"peerDependencies": {
"ember-fetch": "^8.0.1"
},
"ember": {
"edition": "octane"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"application-template-wrapper": false,
"default-async-observers": true,
"jquery-integration": true,
"jquery-integration": false,
"template-only-glimmer-components": true
}
5 changes: 0 additions & 5 deletions packages/ember-simple-auth/tests/helpers/destroy-app.js

This file was deleted.

21 changes: 0 additions & 21 deletions packages/ember-simple-auth/tests/helpers/module-for-acceptance.js

This file was deleted.

Loading

0 comments on commit b120bc4

Please sign in to comment.