Skip to content

Commit f5b03b0

Browse files
committed
Revision 2
1 parent accc85e commit f5b03b0

File tree

51 files changed

+1363
-902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1363
-902
lines changed

addon/components/liquid-tether.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import Ember from 'ember';
22
import LiquidWormhole from 'liquid-wormhole/components/liquid-wormhole';
3-
import layout from '../templates/components/liquid-tether';
43

5-
const { computed, get, observer, run } = Ember;
4+
const { computed, get, run } = Ember;
65

76
const { camelize } = Ember.String;
87

98
export default LiquidWormhole.extend({
10-
layout,
11-
129
classPrefix: 'liquid-tether',
1310
target: null,
1411
attachment: null,
@@ -26,6 +23,10 @@ export default LiquidWormhole.extend({
2623
},
2724

2825
willAppendNodes(bodyElement) {
26+
if (this._tether) {
27+
this.removeTether();
28+
}
29+
2930
this.addTether(bodyElement);
3031
},
3132

@@ -75,23 +76,6 @@ export default LiquidWormhole.extend({
7576
}
7677
},
7778

78-
tetherDidChange: observer(
79-
'class-prefix',
80-
'target',
81-
'attachment',
82-
'targetAttachment',
83-
'offset',
84-
'targetOffset',
85-
'targetModifier',
86-
'constraints',
87-
'optimizations',
88-
'to',
89-
function() {
90-
this.removeTether(this._tether);
91-
this.addTether();
92-
}
93-
),
94-
9579
_tetherTarget: computed('target', function() {
9680
let target = get(this, 'target');
9781
if (target && target.element) {

addon/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import Constraint from 'liquid-fire/constraint';
22

33
export function target(name) {
4-
return new Constraint('parentElementClass', (className) => {
5-
if (className.match('-liquid-target')) {
6-
const targetName = className.replace('-liquid-target', '');
7-
return targetName.match(name);
8-
}
9-
});
4+
return new Constraint('parentElementClass', `${name}`);
105
}
116

7+
128
export function onOpenTether() {
13-
return new Constraint('newValue', ({ emptyTarget }) => !emptyTarget);
9+
return new Constraint('newValue', (value) => value !== null);
1410
}
1511

1612
export function onCloseTether() {
17-
return new Constraint('newValue', ({ emptyTarget }) => emptyTarget);
13+
return new Constraint('newValue', (value) => value === null);
1814
}

addon/styles/addon.css

Lines changed: 0 additions & 150 deletions
This file was deleted.

addon/templates/components/liquid-tether.hbs

Lines changed: 0 additions & 5 deletions
This file was deleted.

app/transitions/tether.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "liquid-tether",
3-
"version": "2.0.0-beta.1",
3+
"version": "2.0.0-beta.2",
44
"description": "Modals made easy",
55
"directories": {
66
"doc": "doc",
@@ -34,15 +34,13 @@
3434
"ember-cli-test-loader": "^1.1.0",
3535
"ember-cli-uglify": "^1.2.0",
3636
"ember-cli-markdown-compiler": "pzuraq/ember-cli-markdown-compiler#example-site-fixes",
37-
"ember-code-snippet": "1.1.3",
3837
"liquid-fire": "0.26.1",
3938
"ui-tabs": "firefly-ui/ui-tabs",
4039
"phantomjs": "^2.0.0",
4140
"ember-disable-prototype-extensions": "^1.1.0",
4241
"ember-export-application-global": "^1.0.5",
4342
"ember-load-initializers": "^0.5.1",
4443
"ember-resolver": "^2.0.3",
45-
"ember-try": "^0.1.2",
4644
"loader.js": "^4.0.1"
4745
},
4846
"keywords": [
@@ -51,7 +49,7 @@
5149
"dependencies": {
5250
"broccoli-funnel": "^0.2.8",
5351
"broccoli-merge-trees": "^0.2.3",
54-
"liquid-wormhole": "pzuraq/liquid-wormhole#v2.0.0-beta.1",
52+
"liquid-wormhole": "v2.0.0-beta.2",
5553
"tether": "pzuraq/tether#adds-option-to-specify-body-element",
5654
"ember-cli-htmlbars": "^1.0.3",
5755
"ember-cli-babel": "^5.1.6"

tests/acceptance/demo-test.js

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global ranTetherTransition, ranOverlayTransition, noTransitionsYet */
1+
/* global ranWormholeTransition, noTransitionsYet */
22
import moduleForAcceptance from '../helpers/module-for-acceptance';
33
import { injectTransitionSpies } from '../helpers/integration';
44

@@ -13,82 +13,66 @@ moduleForAcceptance('Acceptance | Demos', {
1313
}
1414
});
1515

16-
test('target container exists and is empty on load', function() {
17-
visit('/examples');
18-
19-
andThen(() => {
20-
noTransitionsYet();
21-
equal(find('.liquid-target-container').length, 1, 'it exists');
22-
equal(find('.liquid-target-container > .liquid-target').length, 0, 'it\'s empty');
23-
});
24-
});
25-
2616
test('target container is cleaned when empty', function() {
27-
visit('/examples');
17+
visit('/docs');
2818
click('#hello-world-button');
2919
click('#hello-world-button');
3020

3121
andThen(() => {
32-
equal(find('.liquid-target-container > .liquid-target').length, 0, 'it\'s empty');
22+
equal(find('.default-liquid-destination .liquid-destination-stack').length, 0, 'it\'s empty');
3323
});
3424
});
3525

3626
test('basic liquid-tether works correctly', function() {
37-
visit('/examples');
27+
visit('/docs');
3828
noTransitionsYet();
3929

4030
click('#hello-world-button');
4131
andThen(() => {
42-
equal(find('.liquid-target-container .liquid-tether').length, 1, 'it exists');
43-
ranTetherTransition('fade-left');
32+
equal(find('.default-liquid-destination .liquid-wormhole-element').length, 1, 'it exists');
33+
ranWormholeTransition('fade-down');
4434
});
4535
});
4636

47-
test('tethers can determine context', function() {
48-
visit('/examples');
37+
test('tethers can determine context with stacks', function() {
38+
visit('/docs/stacks');
4939

5040
click('#animation-with-context-button');
51-
andThen(() => ranTetherTransition('fade'));
52-
andThen(() => ranOverlayTransition('fade'));
41+
andThen(() => ranWormholeTransition('fade'));
5342

5443
click('button:contains(Next)');
55-
andThen(() => ranTetherTransition('to-left'));
44+
andThen(() => ranWormholeTransition('to-left'));
5645

5746
click('button:contains(Back)');
58-
andThen(() => ranTetherTransition('to-right'));
47+
andThen(() => ranWormholeTransition('to-right'));
5948

6049
click('button:contains(Cancel)');
61-
andThen(() => ranTetherTransition('fade'));
62-
andThen(() => ranOverlayTransition('fade'));
50+
andThen(() => ranWormholeTransition('fade'));
6351
});
6452

65-
test('routed tethers can determine context', function() {
66-
visit('/examples/step-one');
67-
andThen(() => ranTetherTransition('fade'));
68-
andThen(() => ranOverlayTransition('fade'));
53+
test('routed tethers can determine context with stacks', function() {
54+
visit('/docs/routed-tethers/step-one');
55+
andThen(() => ranWormholeTransition('fade'));
6956

70-
visit('/examples/step-two');
71-
andThen(() => ranTetherTransition('to-left'));
57+
visit('/docs/routed-tethers/step-two');
58+
andThen(() => ranWormholeTransition('to-left'));
7259

73-
visit('/examples/step-one');
74-
andThen(() => ranTetherTransition('to-right'));
60+
visit('/docs/routed-tethers/step-one');
61+
andThen(() => ranWormholeTransition('to-right'));
7562

76-
visit('/examples');
77-
andThen(() => ranTetherTransition('fade'));
78-
andThen(() => ranOverlayTransition('fade'));
63+
visit('/docs');
64+
andThen(() => ranWormholeTransition('fade'));
7965
});
8066

8167
test('clickable overlay responds and has correct class', function() {
82-
visit('/examples');
68+
visit('/docs/stacks');
8369

8470
click('#animation-with-context-button');
85-
andThen(() => ranTetherTransition('fade'));
86-
andThen(() => ranOverlayTransition('fade'));
71+
andThen(() => ranWormholeTransition('fade'));
8772
andThen(() => {
88-
equal(find('.liquid-tether-overlay.clickable').length, 1, 'clickable overlay exists');
73+
equal(find('.modal-backdrop').length, 1, 'overlay exists');
8974
});
9075

91-
click('.liquid-tether-overlay.clickable');
92-
andThen(() => ranTetherTransition('fade'));
93-
andThen(() => ranOverlayTransition('fade'));
76+
click('.modal-backdrop');
77+
andThen(() => ranWormholeTransition('fade'));
9478
});

0 commit comments

Comments
 (0)