Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Varankin committed Sep 9, 2014
1 parent 1c3b4d3 commit 9739588
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('dropdown', function() {
BEMDOM.destruct(dropdown.domElem);
});

it('should open on button click', function() {
it('should open on link click', function() {
dropdown.getSwitcher().emit('click');
dropdown.hasMod('opened').should.be.true;
});
Expand Down
2 changes: 2 additions & 0 deletions common.blocks/dropdown/dropdown.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ block('dropdown')(
popupMods.theme || (popupMods.theme = this.mods.theme);
popupMods.hasOwnProperty('autoclosable') || (popupMods.autoclosable = true);

popupMods.target = 'anchor';

return [
{ elem : 'switcher', content : this.ctx.switcher },
popup
Expand Down
2 changes: 2 additions & 0 deletions common.blocks/dropdown/dropdown.bh.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = function(bh) {
popupMods.theme || (popupMods.theme = ctx.mod('theme'));
popupMods.hasOwnProperty('autoclosable') || (popupMods.autoclosable = true);

popupMods.target = 'anchor';

ctx.content([
{ elem : 'switcher', content : json.switcher },
popup
Expand Down
8 changes: 7 additions & 1 deletion common.blocks/dropdown/dropdown.deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
mustDeps : { block : 'i-bem', elem : 'dom' },
shouldDeps : [
{ elem : 'switcher' },
{ block : 'popup', mods : { autoclosable : true } }
{
block : 'popup',
mods : {
autoclosable : true,
target : 'anchor'
}
}
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ provide(BEMDOM.decl(this.name, /** @lends dropdown.prototype */{
getPopup : function() {
return this._popup ||
(this._popup = this.findBlockInside('popup')
.setTarget(this.getSwitcher())
.setAnchor(this.getSwitcher())
.on({ modName : 'visible', modVal : '*' }, this._onPopupVisibilityChange, this));
},

Expand Down
2 changes: 1 addition & 1 deletion common.blocks/select/select.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ block('select')(
{ elem : 'button' },
{
block : 'popup',
mods : { theme : this.mods.theme, autoclosable : true },
mods : { target : 'anchor', theme : this.mods.theme, autoclosable : true },
directions : ['bottom-left', 'bottom-right', 'top-left', 'top-right'],
content : { block : this.block, mods : this.mods, elem : 'menu' }
}
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/select/select.bh.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = function(bh) {
{ elem : 'button' },
{
block : 'popup',
mods : { theme : ctx.mod('theme'), autoclosable : true },
mods : { target : 'anchor', theme : ctx.mod('theme'), autoclosable : true },
directions : ['bottom-left', 'bottom-right', 'top-left', 'top-right'],
content : { block : json.block, mods : ctx.mods(), elem : 'menu' }
}
Expand Down
8 changes: 7 additions & 1 deletion common.blocks/select/select.deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
shouldDeps : [
{ mods : { focused : true } },
{ elems : ['control', 'button', 'menu'] },
{ block : 'popup', mods : { autoclosable : true } },
{
block : 'popup',
mods : {
autoclosable : true,
target : 'anchor'
}
},
{ block : 'keyboard', elem : 'codes' },
{ block : 'strings', elem : 'escape' }
]
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ provide(BEMDOM.decl(this.name, /** @lends select.prototype */{
.on('click', this._onButtonClick, this);

this._popup = this.findBlockInside('popup')
.setTarget(this._button)
.setAnchor(this._button)
.on({ modName : 'visible', modVal : '' }, this._onPopupHide, this);

this._menu = this._popup.findBlockInside('menu')
Expand Down

0 comments on commit 9739588

Please sign in to comment.