diff --git a/src/share-button.js b/src/share-button.js index a83c8ad..527b9e7 100644 --- a/src/share-button.js +++ b/src/share-button.js @@ -271,7 +271,7 @@ class ShareButton extends ShareUtils { */ _eventToggle(button, networks) { if (this._hasClass(networks, 'active')) - this._eventClose(networks); + this._eventClose(button, networks); else this._eventOpen(button, networks); } @@ -299,9 +299,10 @@ class ShareButton extends ShareUtils { * @private * * @param {DOMNode} button + * @param {DOMNode} networks */ - _eventClose(button) { - this._removeClass(button, 'active'); + _eventClose(button, networks) { + this._removeClass(networks, 'active'); } /** diff --git a/tests/features/basic.feature b/tests/features/basic.feature index 44569e8..a10c606 100644 --- a/tests/features/basic.feature +++ b/tests/features/basic.feature @@ -7,3 +7,8 @@ Feature: Basic Button Scenario: All social networks should be displayed When I click the Share Button Then I should see all Social Networks + + @basic + Scenario: All social networks should be hidden + When I close the Share Button manually by calling the close method + Then I should no longer see any Social Network diff --git a/tests/fixtures/basic.html b/tests/fixtures/basic.html index eb1aaa2..57fca0a 100644 --- a/tests/fixtures/basic.html +++ b/tests/fixtures/basic.html @@ -17,6 +17,14 @@ right: 0; z-index: 100; } + #close { + float: right; + border: 2px solid #f00; + padding: 10px; + text-transform: uppercase; + background-color: #fff; + text-align: center; + } @@ -24,6 +32,7 @@