Skip to content

Commit

Permalink
Merge pull request #64 from pzuraq/v2.0.0-beta.2
Browse files Browse the repository at this point in the history
Revision 2
  • Loading branch information
pzuraq committed Sep 24, 2016
2 parents accc85e + f5b03b0 commit f2af3a4
Show file tree
Hide file tree
Showing 51 changed files with 1,363 additions and 902 deletions.
26 changes: 5 additions & 21 deletions addon/components/liquid-tether.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import Ember from 'ember';
import LiquidWormhole from 'liquid-wormhole/components/liquid-wormhole';
import layout from '../templates/components/liquid-tether';

const { computed, get, observer, run } = Ember;
const { computed, get, run } = Ember;

const { camelize } = Ember.String;

export default LiquidWormhole.extend({
layout,

classPrefix: 'liquid-tether',
target: null,
attachment: null,
Expand All @@ -26,6 +23,10 @@ export default LiquidWormhole.extend({
},

willAppendNodes(bodyElement) {
if (this._tether) {
this.removeTether();
}

this.addTether(bodyElement);
},

Expand Down Expand Up @@ -75,23 +76,6 @@ export default LiquidWormhole.extend({
}
},

tetherDidChange: observer(
'class-prefix',
'target',
'attachment',
'targetAttachment',
'offset',
'targetOffset',
'targetModifier',
'constraints',
'optimizations',
'to',
function() {
this.removeTether(this._tether);
this.addTether();
}
),

_tetherTarget: computed('target', function() {
let target = get(this, 'target');
if (target && target.element) {
Expand Down
12 changes: 4 additions & 8 deletions addon/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import Constraint from 'liquid-fire/constraint';

export function target(name) {
return new Constraint('parentElementClass', (className) => {
if (className.match('-liquid-target')) {
const targetName = className.replace('-liquid-target', '');
return targetName.match(name);
}
});
return new Constraint('parentElementClass', `${name}`);
}


export function onOpenTether() {
return new Constraint('newValue', ({ emptyTarget }) => !emptyTarget);
return new Constraint('newValue', (value) => value !== null);
}

export function onCloseTether() {
return new Constraint('newValue', ({ emptyTarget }) => emptyTarget);
return new Constraint('newValue', (value) => value === null);
}
150 changes: 0 additions & 150 deletions addon/styles/addon.css

This file was deleted.

5 changes: 0 additions & 5 deletions addon/templates/components/liquid-tether.hbs

This file was deleted.

8 changes: 0 additions & 8 deletions app/transitions/tether.js

This file was deleted.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liquid-tether",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Modals made easy",
"directories": {
"doc": "doc",
Expand Down Expand Up @@ -34,15 +34,13 @@
"ember-cli-test-loader": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-cli-markdown-compiler": "pzuraq/ember-cli-markdown-compiler#example-site-fixes",
"ember-code-snippet": "1.1.3",
"liquid-fire": "0.26.1",
"ui-tabs": "firefly-ui/ui-tabs",
"phantomjs": "^2.0.0",
"ember-disable-prototype-extensions": "^1.1.0",
"ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3",
"ember-try": "^0.1.2",
"loader.js": "^4.0.1"
},
"keywords": [
Expand All @@ -51,7 +49,7 @@
"dependencies": {
"broccoli-funnel": "^0.2.8",
"broccoli-merge-trees": "^0.2.3",
"liquid-wormhole": "pzuraq/liquid-wormhole#v2.0.0-beta.1",
"liquid-wormhole": "v2.0.0-beta.2",
"tether": "pzuraq/tether#adds-option-to-specify-body-element",
"ember-cli-htmlbars": "^1.0.3",
"ember-cli-babel": "^5.1.6"
Expand Down
68 changes: 26 additions & 42 deletions tests/acceptance/demo-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global ranTetherTransition, ranOverlayTransition, noTransitionsYet */
/* global ranWormholeTransition, noTransitionsYet */
import moduleForAcceptance from '../helpers/module-for-acceptance';
import { injectTransitionSpies } from '../helpers/integration';

Expand All @@ -13,82 +13,66 @@ moduleForAcceptance('Acceptance | Demos', {
}
});

test('target container exists and is empty on load', function() {
visit('/examples');

andThen(() => {
noTransitionsYet();
equal(find('.liquid-target-container').length, 1, 'it exists');
equal(find('.liquid-target-container > .liquid-target').length, 0, 'it\'s empty');
});
});

test('target container is cleaned when empty', function() {
visit('/examples');
visit('/docs');
click('#hello-world-button');
click('#hello-world-button');

andThen(() => {
equal(find('.liquid-target-container > .liquid-target').length, 0, 'it\'s empty');
equal(find('.default-liquid-destination .liquid-destination-stack').length, 0, 'it\'s empty');
});
});

test('basic liquid-tether works correctly', function() {
visit('/examples');
visit('/docs');
noTransitionsYet();

click('#hello-world-button');
andThen(() => {
equal(find('.liquid-target-container .liquid-tether').length, 1, 'it exists');
ranTetherTransition('fade-left');
equal(find('.default-liquid-destination .liquid-wormhole-element').length, 1, 'it exists');
ranWormholeTransition('fade-down');
});
});

test('tethers can determine context', function() {
visit('/examples');
test('tethers can determine context with stacks', function() {
visit('/docs/stacks');

click('#animation-with-context-button');
andThen(() => ranTetherTransition('fade'));
andThen(() => ranOverlayTransition('fade'));
andThen(() => ranWormholeTransition('fade'));

click('button:contains(Next)');
andThen(() => ranTetherTransition('to-left'));
andThen(() => ranWormholeTransition('to-left'));

click('button:contains(Back)');
andThen(() => ranTetherTransition('to-right'));
andThen(() => ranWormholeTransition('to-right'));

click('button:contains(Cancel)');
andThen(() => ranTetherTransition('fade'));
andThen(() => ranOverlayTransition('fade'));
andThen(() => ranWormholeTransition('fade'));
});

test('routed tethers can determine context', function() {
visit('/examples/step-one');
andThen(() => ranTetherTransition('fade'));
andThen(() => ranOverlayTransition('fade'));
test('routed tethers can determine context with stacks', function() {
visit('/docs/routed-tethers/step-one');
andThen(() => ranWormholeTransition('fade'));

visit('/examples/step-two');
andThen(() => ranTetherTransition('to-left'));
visit('/docs/routed-tethers/step-two');
andThen(() => ranWormholeTransition('to-left'));

visit('/examples/step-one');
andThen(() => ranTetherTransition('to-right'));
visit('/docs/routed-tethers/step-one');
andThen(() => ranWormholeTransition('to-right'));

visit('/examples');
andThen(() => ranTetherTransition('fade'));
andThen(() => ranOverlayTransition('fade'));
visit('/docs');
andThen(() => ranWormholeTransition('fade'));
});

test('clickable overlay responds and has correct class', function() {
visit('/examples');
visit('/docs/stacks');

click('#animation-with-context-button');
andThen(() => ranTetherTransition('fade'));
andThen(() => ranOverlayTransition('fade'));
andThen(() => ranWormholeTransition('fade'));
andThen(() => {
equal(find('.liquid-tether-overlay.clickable').length, 1, 'clickable overlay exists');
equal(find('.modal-backdrop').length, 1, 'overlay exists');
});

click('.liquid-tether-overlay.clickable');
andThen(() => ranTetherTransition('fade'));
andThen(() => ranOverlayTransition('fade'));
click('.modal-backdrop');
andThen(() => ranWormholeTransition('fade'));
});

0 comments on commit f2af3a4

Please sign in to comment.