Fix the notification highlighter tests
This commit is contained in:
parent
cf4f5c89e0
commit
6f27f40962
|
|
@ -310,6 +310,7 @@
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
var uid = $(this).parent().data('musician-id');
|
var uid = $(this).parent().data('musician-id');
|
||||||
rest.sendFriendRequest(app, uid, friendRequestCallback);
|
rest.sendFriendRequest(app, uid, friendRequestCallback);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function friendRequestCallback(user_id) {
|
function friendRequestCallback(user_id) {
|
||||||
|
|
|
||||||
|
|
@ -1152,7 +1152,7 @@
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(userId);
|
callback(userId, app);
|
||||||
}
|
}
|
||||||
context.JK.GA.trackFriendConnect(context.JK.GA.FriendConnectTypes.request);
|
context.JK.GA.trackFriendConnect(context.JK.GA.FriendConnectTypes.request);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -445,16 +445,20 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter extends BaseSearchF
|
||||||
|
|
||||||
_bindFriendMusician: () =>
|
_bindFriendMusician: () =>
|
||||||
objThis = this
|
objThis = this
|
||||||
|
callback = this.friendRequestCallback
|
||||||
@screen.find('.search-m-friend').on 'click', (evt) ->
|
@screen.find('.search-m-friend').on 'click', (evt) ->
|
||||||
# if the musician is already a friend, remove the button-orange class, and prevent the link from working
|
# if the musician is already a friend, remove the button-orange class, and prevent the link from working
|
||||||
|
console.log("friend request connected")
|
||||||
if 0 == $(this).closest('.button-orange').size()
|
if 0 == $(this).closest('.button-orange').size()
|
||||||
|
console.log("friend request bail out")
|
||||||
return false
|
return false
|
||||||
$(this).click (ee) ->
|
$(this).click (ee) ->
|
||||||
ee.preventDefault()
|
ee.preventDefault()
|
||||||
return
|
return false
|
||||||
evt.stopPropagation()
|
evt.stopPropagation()
|
||||||
uid = $(this).parent().data('musician-id')
|
uid = $(this).parent().data('musician-id')
|
||||||
objThis.rest.sendFriendRequest objThis.app, uid, this.friendRequestCallback
|
objThis.rest.sendFriendRequest(objThis.app, uid, callback)
|
||||||
|
return false
|
||||||
|
|
||||||
_bindFollowMusician: () =>
|
_bindFollowMusician: () =>
|
||||||
objThis = this
|
objThis = this
|
||||||
|
|
@ -493,8 +497,9 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter extends BaseSearchF
|
||||||
else
|
else
|
||||||
'Location Unavailable'
|
'Location Unavailable'
|
||||||
|
|
||||||
friendRequestCallback: (user_id)=>
|
friendRequestCallback: (user_id, app)=>
|
||||||
# TODO:
|
$('div[data-musician-id=' + user_id + '] .search-m-friend').removeClass('button-orange').addClass('button-grey');
|
||||||
|
app.notify({title: 'Friend Request Sent', text: 'Your friend request has been sent! They have to approve to become friends.'});
|
||||||
|
|
||||||
paginate: () =>
|
paginate: () =>
|
||||||
super()
|
super()
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNotificationOccurred(payload) {
|
function onNotificationOccurred(payload) {
|
||||||
|
|
||||||
|
incrementNotificationCount();
|
||||||
|
highlightCount();
|
||||||
|
|
||||||
|
|
||||||
if(userCanSeeNotifications(payload)) {
|
if(userCanSeeNotifications(payload)) {
|
||||||
app.updateNotificationSeen(payload.notification_id, payload.created_at);
|
app.updateNotificationSeen(payload.notification_id, payload.created_at);
|
||||||
}
|
}
|
||||||
|
|
@ -105,8 +110,6 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
queueNotificationSeen(payload.notification_id, payload.created_at, payload.description);
|
queueNotificationSeen(payload.notification_id, payload.created_at, payload.description);
|
||||||
highlightCount();
|
|
||||||
incrementNotificationCount();
|
|
||||||
missedNotificationsWhileAway = true;
|
missedNotificationsWhileAway = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@
|
||||||
|
|
||||||
if ($btn.is('.disabled')) {
|
if ($btn.is('.disabled')) {
|
||||||
logger.debug("ignoring send friend request on disabled btn")
|
logger.debug("ignoring send friend request on disabled btn")
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
var userId = $btn.parent().attr('user-id');
|
var userId = $btn.parent().attr('user-id');
|
||||||
|
|
||||||
|
|
@ -232,7 +232,7 @@
|
||||||
app.notify({title: 'Friend Request Sent', text: 'Your friend request has been sent'})
|
app.notify({title: 'Friend Request Sent', text: 'Your friend request has been sent'})
|
||||||
$btn.addClass('disabled')
|
$btn.addClass('disabled')
|
||||||
})
|
})
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@
|
||||||
> a.smallbutton {
|
> a.smallbutton {
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
&.button-grey {
|
&.button-grey {
|
||||||
display:none; // @FIXME VRFS-930 / VRFS-931 per comment from David - don't show.
|
//display:none; // @FIXME VRFS-930 / VRFS-931 per comment from David - don't show.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
||||||
notification.errors.any?.should be false
|
notification.errors.any?.should be false
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like :notification_badge, highlighted: false, count:0, action: :click
|
it_behaves_like :notification_badge, highlighted: true, count:1, action: :click
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "document out of focus" do
|
describe "document out of focus" do
|
||||||
|
|
@ -83,7 +83,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
||||||
find('#notification #btn-reply') # wait for notification to show, so that we know the sidebar had a chance to update
|
find('#notification #btn-reply') # wait for notification to show, so that we know the sidebar had a chance to update
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like :notification_badge, highlighted: false, count:0
|
it_behaves_like :notification_badge, highlighted: true, count:1
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "document out of focus" do
|
describe "document out of focus" do
|
||||||
|
|
@ -150,9 +150,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
||||||
JamRuby::Score.connection.execute('delete from current_network_scores').check
|
JamRuby::Score.connection.execute('delete from current_network_scores').check
|
||||||
JamRuby::Score.createx(1, 'a', 1, 2, 'b', 2, 10)
|
JamRuby::Score.createx(1, 'a', 1, 2, 'b', 2, 10)
|
||||||
|
|
||||||
in_client(user) do
|
sign_in_poltergeist(user)
|
||||||
sign_in_poltergeist(user)
|
|
||||||
end
|
|
||||||
|
|
||||||
in_client(user2) do
|
in_client(user2) do
|
||||||
sign_in_poltergeist(user2)
|
sign_in_poltergeist(user2)
|
||||||
|
|
@ -160,15 +158,14 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f
|
||||||
find(".result-list-button-wrapper[data-musician-id='#{user.id}'] .search-m-friend").click
|
find(".result-list-button-wrapper[data-musician-id='#{user.id}'] .search-m-friend").click
|
||||||
end
|
end
|
||||||
|
|
||||||
in_client(user) do
|
|
||||||
badge = find("#{NOTIFICATION_PANEL} .badge", text: '1')
|
|
||||||
badge['class'].include?('highlighted').should == true
|
|
||||||
|
|
||||||
find('#notification #btn-accept', text: 'ACCEPT').trigger(:click)
|
badge = find("#{NOTIFICATION_PANEL} .badge", text: '1')
|
||||||
|
badge['class'].include?('highlighted').should == true
|
||||||
|
|
||||||
badge = find("#{NOTIFICATION_PANEL} .badge", text: '0')
|
find('#notification #btn-accept', text: 'ACCEPT').click
|
||||||
badge['class'].include?('highlighted').should == false
|
|
||||||
end
|
badge = find("#{NOTIFICATION_PANEL} .badge", text: '0')
|
||||||
|
badge['class'].include?('highlighted').should == false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,10 @@ Thread.new do
|
||||||
JamWebsockets::Server.new.run(
|
JamWebsockets::Server.new.run(
|
||||||
:port => 6759,
|
:port => 6759,
|
||||||
:emwebsocket_debug => false,
|
:emwebsocket_debug => false,
|
||||||
:connect_time_stale_client => 4,
|
:connect_time_stale_client => 80,
|
||||||
:connect_time_expire_client => 6,
|
:connect_time_expire_client => 120,
|
||||||
:connect_time_stale_browser => 4,
|
:connect_time_stale_browser => 80,
|
||||||
:connect_time_expire_browser => 6,
|
:connect_time_expire_browser => 120,
|
||||||
:max_connections_per_user => 20,
|
:max_connections_per_user => 20,
|
||||||
:rabbitmq_host => '127.0.0.1',
|
:rabbitmq_host => '127.0.0.1',
|
||||||
:rabbitmq_port => 5672,
|
:rabbitmq_port => 5672,
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,12 @@ end
|
||||||
|
|
||||||
# in place of ever using Capybara.session_name directly,
|
# in place of ever using Capybara.session_name directly,
|
||||||
# this utility is used to handle the mapping of session names in a way across all tests runs
|
# this utility is used to handle the mapping of session names in a way across all tests runs
|
||||||
def in_client(name)
|
def in_client(name, &blk)
|
||||||
session_name = name.class == JamRuby::User ? name.id : name
|
session_name = name.class == JamRuby::User ? name.id : name
|
||||||
|
|
||||||
Capybara.session_name = mapped_session_name(session_name)
|
#Capybara.session_name = mapped_session_name(session_name)
|
||||||
|
|
||||||
yield
|
Capybara.using_session(session_name, &blk)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue