Skip to content

Commit

Permalink
This commit resolves #53, resolves #55, resolves #56, resolves #57, r…
Browse files Browse the repository at this point in the history
…esolves #58, resolves #60
  • Loading branch information
Алексей Пивкин committed Jun 26, 2019
1 parent 58ab99f commit 34267e8
Show file tree
Hide file tree
Showing 8 changed files with 1,739 additions and 676 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## v2.1.0 (26/06/2019)

#### Bug Fixes:

- [#53](https://github.com/avil13/vue-sweetalert2/issues/54) Uncaught (in promise) TypeError: Cannot read property '$swal' of undefined at eval
- [#55](https://github.com/avil13/vue-sweetalert2/issues/55) How to use when passing options?
- [#56](https://github.com/avil13/vue-sweetalert2/issues/56) Object doesn't support property or method 'mixin'
- [#57](https://github.com/avil13/vue-sweetalert2/issues/57) showLoading
- [#58](https://github.com/avil13/vue-sweetalert2/issues/58) Close sweetalert

#### Enhancements:

- [#60](https://github.com/avil13/vue-sweetalert2/issues/60) Custom Styles not working after update

---
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ npm install -S vue-sweetalert2
import Vue from 'vue';
import VueSweetalert2 from 'vue-sweetalert2';

// If you don't need the styles, do not connect
import 'sweetalert2/dist/sweetalert2.min.css';

Vue.use(VueSweetalert2);
```

Expand Down
48 changes: 48 additions & 0 deletions __tests__/swal-methods.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'jest';
import { createLocalVue } from '@vue/test-utils';
import Swal from 'sweetalert2';

import VueSweetalert2 from '../src';

const factory = () => {
const localVue = createLocalVue();
localVue.use(VueSweetalert2);
return localVue;
};


/**
* Return list of all methods name in array: [ ['methodName'] ]
* need for each list methods testing
*/
function getAllMethodsNames(): string[][] {
const keys = Object.keys(Swal);

return keys
.filter(name => typeof Swal[name] === 'function')
.map(methodName => [methodName]);
}

const allMethodsNames = getAllMethodsNames();


describe('Vue-SweetAlert2 swal methods v.8.x', () => {
it.skip('should fire onOpen option key', () => {
const Vue = factory();
const onOpen = jest.fn();

Vue.swal({
animation: false,
onOpen
});

// TODO: add global window mock
expect(onOpen).toBeCalled();
});

it.each(allMethodsNames)('should check methods', method => {
const Vue = factory();

expect(Vue.swal[method]).toBeTruthy();
});
});
Loading

0 comments on commit 34267e8

Please sign in to comment.