Skip to content

Commit

Permalink
Release 2.1.5 (#231)
Browse files Browse the repository at this point in the history
* Update installation.md (#218)

Added .com TLD to CDN URL

* Fix typos in docs (#219)

* Fix typos in docs

* Fix typos

* docs: Remove outdated line from poral-target docs

I think this is something from the previous version

* fix: Wormhole.close force=true and from=undefined

* deps: remove cypress

we don't have e2e tests right now.
package takes up considerable size

* example: programmatic example should use
right build file.

* build: 2.1.5


Co-authored-by: Mohd Shakir Zakaria <mohdshakir@gmail.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
Co-authored-by: Mitar <mitar.github@tnode.com>
Co-authored-by: Gohy Leandre <leandre.gohy@hexeo.be>
  • Loading branch information
5 people committed Jun 1, 2019
1 parent c49a452 commit 754c3a8
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 657 deletions.
2 changes: 1 addition & 1 deletion dist/portal-vue.common.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/portal-vue.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/portal-vue.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*!
* portal-vue © Thorsten Lünborg, 2019
*
* Version: 2.1.4
* Version: 2.1.5
*
* LICENCE: MIT
*
Expand Down
2 changes: 1 addition & 1 deletion dist/portal-vue.umd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/api/portal-target.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ Emitted everytime the component re-renders because the content from the `<Portal

It receives two arguments, each is a `Boolean`, indicating the absense or presence of content for the target.

The first argument is represents the current contents, the second one the previous contents (just like the arguments of a `watch` handler in a Vue component)

<!-- prettier-ignore -->
```html {4}
<template>
Expand Down
10 changes: 5 additions & 5 deletions example/components/programmatic/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

<script lang="ts">
import Vue from 'vue'
import { Wormhole } from 'portal-vue'
// const { Wormhole } =
// process.env.NODE_ENV === 'production'
// ? require('@/../dist/portal-vue.common.js')
// : require('@/index').default
const { Wormhole } =
process.env.NODE_ENV === 'production'
? require('@/../dist/portal-vue.common.js')
: require('@/index').default
export default Vue.extend({
data() {
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portal-vue",
"version": "2.1.4",
"version": "2.1.5",
"license": "MIT",
"repository": "https://github.com/LinusBorg/portal-vue",
"author": {
Expand All @@ -17,8 +17,7 @@
"minify": "minify dist/portal-vue.umd.js --out-file dist/portal-vue.umd.min.js",
"lint": "vue-cli-service lint",
"test": "yarn test:unit",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e"
"test:unit": "vue-cli-service test:unit"
},
"main": "dist/portal-vue.umd.js",
"module": "dist/portal-vue.esm.js",
Expand All @@ -40,7 +39,6 @@
"@linusborg/vue-ko-fi-button": "^0.1.0",
"@types/jest": "^23.1.4",
"@vue/cli-plugin-babel": "^3.1.0",
"@vue/cli-plugin-e2e-cypress": "^3.1.0",
"@vue/cli-plugin-eslint": "^3.1.0",
"@vue/cli-plugin-typescript": "^3.1.0",
"@vue/cli-plugin-unit-jest": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/wormhole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const Wormhole = Vue.extend({

close(transport: TransportVector, force = false) {
const { to, from } = transport
if (!to || !from) return
if (!to || (!from && force === false)) return
if (!this.transports[to]) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface Transport {

export interface TransportVector {
to: string
from: string
from?: string
}

export type PropWithComponent =
Expand Down
12 changes: 0 additions & 12 deletions tests/e2e/.eslintrc

This file was deleted.

11 changes: 0 additions & 11 deletions tests/e2e/plugins/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions tests/e2e/specs/test.js

This file was deleted.

25 changes: 0 additions & 25 deletions tests/e2e/support/commands.js

This file was deleted.

20 changes: 0 additions & 20 deletions tests/e2e/support/index.js

This file was deleted.

38 changes: 38 additions & 0 deletions tests/unit/specs/wormhole.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,44 @@ describe('Wormhole', function() {
expect(wormhole.transports).toEqual({ target: [] })
})

it('removes content on close() when force=true and from=undefined', () => {
wormhole.open({
from: 'test-portal',
to: 'target',
passengers: ['Test'],
})

wormhole.close(
{
to: 'target',
},
true
) // force argument
expect(wormhole.transports).toEqual({ target: [] })
})

it('closes all transports to the same target when force=true and from=undefined', () => {
wormhole.open({
from: 'test-portal1',
to: 'target',
passengers: ['Test1'],
})

wormhole.open({
from: 'test-portal2',
to: 'target',
passengers: ['Test2'],
})

wormhole.close(
{
to: 'target',
},
true
) // force argument
expect(wormhole.transports).toEqual({ target: [] })
})

it('hasTarget()', function() {
const check1 = wormhole.hasTarget('target')
expect(check1).toBe(false)
Expand Down
2 changes: 1 addition & 1 deletion types/lib/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface Transport {
}
export interface TransportVector {
to: string;
from: string;
from?: string;
}
export declare type PropWithComponent = VueConstructor<Vue> | ComponentOptions<Vue> | string;
export declare type PortalProps = Partial<{
Expand Down

0 comments on commit 754c3a8

Please sign in to comment.