Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
1f08fab4
Commit
1f08fab4
authored
May 02, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '5480-sidebar-subscription-event-handling' into 'master'"
This reverts merge request !18682
parent
6187dc24
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue
...idebar/components/subscriptions/sidebar_subscriptions.vue
+7
-1
app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue
...cripts/sidebar/components/subscriptions/subscriptions.vue
+2
-1
spec/javascripts/sidebar/sidebar_subscriptions_spec.js
spec/javascripts/sidebar/sidebar_subscriptions_spec.js
+2
-1
spec/javascripts/sidebar/subscriptions_spec.js
spec/javascripts/sidebar/subscriptions_spec.js
+0
-8
No files found.
app/assets/javascripts/sidebar/components/subscriptions/sidebar_subscriptions.vue
View file @
1f08fab4
<
script
>
<
script
>
import
Store
from
'
../../stores/sidebar_store
'
;
import
Store
from
'
../../stores/sidebar_store
'
;
import
eventHub
from
'
../../event_hub
'
;
import
Flash
from
'
../../../flash
'
;
import
Flash
from
'
../../../flash
'
;
import
{
__
}
from
'
../../../locale
'
;
import
{
__
}
from
'
../../../locale
'
;
import
subscriptions
from
'
./subscriptions.vue
'
;
import
subscriptions
from
'
./subscriptions.vue
'
;
...
@@ -19,6 +20,12 @@ export default {
...
@@ -19,6 +20,12 @@ export default {
store
:
new
Store
(),
store
:
new
Store
(),
};
};
},
},
created
()
{
eventHub
.
$on
(
'
toggleSubscription
'
,
this
.
onToggleSubscription
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'
toggleSubscription
'
,
this
.
onToggleSubscription
);
},
methods
:
{
methods
:
{
onToggleSubscription
()
{
onToggleSubscription
()
{
this
.
mediator
.
toggleSubscription
()
this
.
mediator
.
toggleSubscription
()
...
@@ -35,7 +42,6 @@ export default {
...
@@ -35,7 +42,6 @@ export default {
<subscriptions
<subscriptions
:loading=
"store.isFetching.subscriptions"
:loading=
"store.isFetching.subscriptions"
:subscribed=
"store.subscribed"
:subscribed=
"store.subscribed"
@
toggleSubscription=
"onToggleSubscription"
/>
/>
</div>
</div>
</
template
>
</
template
>
app/assets/javascripts/sidebar/components/subscriptions/subscriptions.vue
View file @
1f08fab4
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
toggleButton
from
'
~/vue_shared/components/toggle_button.vue
'
;
import
toggleButton
from
'
~/vue_shared/components/toggle_button.vue
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
eventHub
from
'
../../event_hub
'
;
const
ICON_ON
=
'
notifications
'
;
const
ICON_ON
=
'
notifications
'
;
const
ICON_OFF
=
'
notifications-off
'
;
const
ICON_OFF
=
'
notifications-off
'
;
...
@@ -47,7 +48,7 @@
...
@@ -47,7 +48,7 @@
},
},
methods
:
{
methods
:
{
toggleSubscription
()
{
toggleSubscription
()
{
this
.
$emit
(
'
toggleSubscription
'
,
this
.
id
);
eventHub
.
$emit
(
'
toggleSubscription
'
,
this
.
id
);
},
},
},
},
};
};
...
...
spec/javascripts/sidebar/sidebar_subscriptions_spec.js
View file @
1f08fab4
...
@@ -3,6 +3,7 @@ import sidebarSubscriptions from '~/sidebar/components/subscriptions/sidebar_sub
...
@@ -3,6 +3,7 @@ import sidebarSubscriptions from '~/sidebar/components/subscriptions/sidebar_sub
import
SidebarMediator
from
'
~/sidebar/sidebar_mediator
'
;
import
SidebarMediator
from
'
~/sidebar/sidebar_mediator
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
SidebarService
from
'
~/sidebar/services/sidebar_service
'
;
import
SidebarStore
from
'
~/sidebar/stores/sidebar_store
'
;
import
SidebarStore
from
'
~/sidebar/stores/sidebar_store
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
Mock
from
'
./mock_data
'
;
import
Mock
from
'
./mock_data
'
;
...
@@ -31,7 +32,7 @@ describe('Sidebar Subscriptions', function () {
...
@@ -31,7 +32,7 @@ describe('Sidebar Subscriptions', function () {
mediator
,
mediator
,
});
});
vm
.
onToggleSubscription
(
);
eventHub
.
$emit
(
'
toggleSubscription
'
);
expect
(
mediator
.
toggleSubscription
).
toHaveBeenCalled
();
expect
(
mediator
.
toggleSubscription
).
toHaveBeenCalled
();
});
});
...
...
spec/javascripts/sidebar/subscriptions_spec.js
View file @
1f08fab4
...
@@ -39,12 +39,4 @@ describe('Subscriptions', function () {
...
@@ -39,12 +39,4 @@ describe('Subscriptions', function () {
expect
(
vm
.
$refs
.
toggleButton
.
$el
.
querySelector
(
'
.project-feature-toggle
'
)).
toHaveClass
(
'
is-checked
'
);
expect
(
vm
.
$refs
.
toggleButton
.
$el
.
querySelector
(
'
.project-feature-toggle
'
)).
toHaveClass
(
'
is-checked
'
);
});
});
it
(
'
toggleSubscription method emits `toggleSubscription` event on component
'
,
()
=>
{
vm
=
mountComponent
(
Subscriptions
,
{
subscribed
:
true
});
spyOn
(
vm
,
'
$emit
'
);
vm
.
toggleSubscription
();
expect
(
vm
.
$emit
).
toHaveBeenCalledWith
(
'
toggleSubscription
'
,
jasmine
.
any
(
Object
));
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment