Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
Expose toggleOn and toggleOff API methods to facade
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Kunka committed Dec 31, 2016
1 parent 83bf6d9 commit 1d28237
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ in addition to the mandatory data attributes.
## 3.1.2

- Improved `compareVersions` util function to handle semver notation correctly (e.g. `'^'`, `'~'`, `'-beta'`, etc).
- Fixed issue with "Filtering by URL" demo that added a `#mix` segment to the URL for filter "all"
- Fixed issue with "Filtering by URL" demo that added a `#mix` segment to the URL for filter "all"

## 3.1.3

- Exposed `.toggleOn()` and `.toggleOff()` API methods publicly via the mixer facade, as were accidently missed out previously.
6 changes: 3 additions & 3 deletions demos/mixitup.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions dist/mixitup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* MixItUp v3.1.2
* MixItUp v3.1.3
* A high-performance, dependency-free library for animated filtering, sorting and more
* Build 8db25e3d-698e-4c92-9857-72cb05b80ed1
* Build dce0f083-453a-4a55-91fb-7e61d1c4633f
*
* @copyright Copyright 2014-2016 KunkaLabs Limited.
* @author KunkaLabs Limited.
Expand Down Expand Up @@ -10331,6 +10331,8 @@
this.show = mixer.show.bind(mixer);
this.hide = mixer.hide.bind(mixer);
this.filter = mixer.filter.bind(mixer);
this.toggleOn = mixer.toggleOn.bind(mixer);
this.toggleOff = mixer.toggleOff.bind(mixer);
this.sort = mixer.sort.bind(mixer);
this.changeLayout = mixer.changeLayout.bind(mixer);
this.multimix = mixer.multimix.bind(mixer);
Expand Down Expand Up @@ -10376,5 +10378,5 @@
mixitup.registerJqPlugin(jq);
}
mixitup.NAME = 'mixitup';
mixitup.CORE_VERSION = '3.1.2';
mixitup.CORE_VERSION = '3.1.3';
})(window);
6 changes: 3 additions & 3 deletions dist/mixitup.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mixitup",
"title": "MixItUp",
"version": "3.1.2",
"version": "3.1.3",
"description": "A high-performance, dependency-free library for animated filtering, sorting and more",
"author": "KunkaLabs Limited",
"homepage": "https://www.kunkalabs.com/mixitup/",
Expand Down
2 changes: 2 additions & 0 deletions src/facade.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ mixitup.Facade = function Mixer(mixer) {
this.show = mixer.show.bind(mixer);
this.hide = mixer.hide.bind(mixer);
this.filter = mixer.filter.bind(mixer);
this.toggleOn = mixer.toggleOn.bind(mixer);
this.toggleOff = mixer.toggleOff.bind(mixer);
this.sort = mixer.sort.bind(mixer);
this.changeLayout = mixer.changeLayout.bind(mixer);
this.multimix = mixer.multimix.bind(mixer);
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/controls-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ describe('Controls', () => {
chai.assert.equal(state.totalHide, 0);
chai.assert.isNotOk(toggle.matches('.mixitup-control-active'));
});

it('should allow toggles to activated via the API', () => {
let totalMatching = container.querySelectorAll('.category-a.category-c').length;

mixer.toggleOn('.category-a');
mixer.toggleOn('.category-c');

let state = mixer.getState();

chai.assert.equal(state.activeFilter.selector, '.category-a.category-c');
chai.assert.equal(state.totalShow, totalMatching);
});
});

describe('Defaults', () => {
Expand Down

0 comments on commit 1d28237

Please sign in to comment.