Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on ember beta, release, canary #22

Merged
merged 1 commit into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
language: node_js
node_js:
- "0.12"
- "6.2.0"

sudo: false
sudo: required
dist: trusty

cache:
directories:
Expand All @@ -12,18 +13,20 @@ cache:
env:
- EMBER_TRY_SCENARIO=1.13
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=2.3
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary

matrix:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- "npm config set spin false"
- "npm install -g npm@^2"
- npm install -g npm@^3
- npm config set progress false
- npm install -g phantomjs-prebuilt

install:
- npm install -g bower
Expand Down
15 changes: 11 additions & 4 deletions addon/components/render-mobiledoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Ember from 'ember';
import Renderer from 'ember-mobiledoc-dom-renderer';
import { RENDER_TYPE } from 'ember-mobiledoc-dom-renderer';
import layout from '../templates/components/render-mobiledoc';
import { getDOM } from '../utils/dom';

const {
assert,
Expand Down Expand Up @@ -92,9 +93,8 @@ export default Ember.Component.extend({
}),

willRender() {
let emberRenderer = this.get('renderer');
let dom = emberRenderer && emberRenderer._dom;
assert('Unable to get renderer dom helper', !!dom);
let domHelper = getDOM(this);
let dom = domHelper.document;

let cards = this.get('_mdcCards');
let atoms = this.get('_mdcAtoms');
Expand All @@ -104,7 +104,14 @@ export default Ember.Component.extend({
let renderer = new Renderer({atoms, cards, cardOptions, dom});
let { result, teardown } = renderer.render(mobiledoc);

this.set('renderedMobiledoc', result);
// result is a document fragment, and glimmer2 errors when cleaning it up.
// We must append the document fragment to a static wrapper.
// Related: https://github.com/tildeio/glimmer/pull/331 and
// https://github.com/yapplabs/ember-wormhole/issues/66#issuecomment-246207622
let wrapper = this._createElement(dom, 'div');
wrapper.appendChild(result);

this.set('renderedMobiledoc', wrapper);
this._teardownRender = teardown;

this._super(...arguments);
Expand Down
10 changes: 10 additions & 0 deletions addon/utils/dom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function getDOM(context) {
let { renderer } = context;
if (renderer._dom) { // pre glimmer2
return renderer._dom;
} else if (renderer._env && renderer._env.getDOM) { // glimmer 2
return renderer._env.getDOM();
} else {
throw new Error('Unable to get DOM helper');
}
}
18 changes: 15 additions & 3 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@ module.exports = {
{
name: '1.13',
dependencies: {
"ember": "~1.13.7"
"ember": "^1.13"
}
},
{
name: 'default',
dependencies: { }
},
{
name: '2.3',
name: 'ember-release',
dependencies: {
'ember': '2.3.0-beta.1'
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
}
},
{
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ember-mobiledoc-dom-renderer",
"version": "0.5.2",
"description": "provides mobiledoc-dom-renderer to ember apps",
"description": "provides a runtime mobiledoc dom-renderer to ember apps",
"directories": {
"doc": "doc",
"test": "tests"
Expand Down Expand Up @@ -38,7 +38,9 @@
"ember-try": "0.0.6"
},
"keywords": [
"ember-addon"
"ember-addon",
"mobiledoc",
"mobiledoc-kit"
],
"dependencies": {
"broccoli-funnel": "^1.0.0",
Expand Down