Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
407
Merge Requests
66
CI / CD
Security & Compliance
Packages
Analytics
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
103b2981
Commit
103b2981
authored
1 hour ago
by
Marcelo Rivera
Browse files
Options
Download
(feat): spec tests
parent
d6fac608
feat/hide-share-buttons
1 merge request
!776
Allow users to permanently hide "share" buttons in settings
Pipeline
#116918093
running with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
4 deletions
+62
-4
src/app/modules/blogs/view/view.spec.ts
View file @
103b2981
...
...
@@ -28,6 +28,15 @@ import { AnalyticsService } from '../../../services/analytics';
import
{
analyticsServiceMock
}
from
'
../../../../tests/analytics-service-mock.spec
'
;
import
{
ActivityService
}
from
'
../../../common/services/activity.service
'
;
import
{
activityServiceMock
}
from
'
../../../../tests/activity-service-mock.spec
'
;
import
{
By
}
from
'
@angular/platform-browser
'
;
import
{
MetaService
}
from
'
../../../common/services/meta.service
'
;
import
{
metaServiceMock
}
from
'
../../notifications/notification.service.spec
'
;
import
{
OverlayModalService
}
from
'
../../../services/ux/overlay-modal
'
;
import
{
overlayModalServiceMock
}
from
'
../../../../tests/overlay-modal-service-mock.spec
'
;
import
{
ClientMetaService
}
from
'
../../../common/services/client-meta.service
'
;
import
{
clientMetaServiceMock
}
from
'
../../../../tests/client-meta-service-mock.spec
'
;
import
{
ConfigsService
}
from
'
../../../common/services/configs.service
'
;
import
{
MockService
}
from
'
../../../utils/mock
'
;
describe
(
'
Blog view component
'
,
()
=>
{
let
comp
:
BlogView
;
...
...
@@ -36,7 +45,9 @@ describe('Blog view component', () => {
guid
:
'
1
'
,
title
:
'
test blog
'
,
description
:
'
description
'
,
ownerObj
:
{},
ownerObj
:
{
hide_share_buttons
:
false
,
},
allow_comments
:
true
,
perma_url
:
'
/perma
'
,
thumbnail
:
'
/thumbnail
'
,
...
...
@@ -54,6 +65,10 @@ describe('Blog view component', () => {
{
provide
:
ContextService
,
useValue
:
contextServiceMock
},
{
provide
:
ScrollService
,
useValue
:
scrollServiceMock
},
{
provide
:
Session
,
useValue
:
sessionMock
},
{
provide
:
MetaService
,
useValue
:
metaServiceMock
},
{
provide
:
OverlayModalService
,
useValue
:
overlayModalServiceMock
},
{
provide
:
ClientMetaService
,
useValue
:
clientMetaServiceMock
},
{
provide
:
ConfigsService
,
useValue
:
MockService
(
ConfigsService
)
},
],
schemas
:
[
NO_ERRORS_SCHEMA
],
})
...
...
@@ -63,9 +78,31 @@ describe('Blog view component', () => {
// synchronous beforeEach
beforeEach
(()
=>
{
jasmine
.
clock
().
uninstall
();
jasmine
.
clock
().
install
();
fixture
=
TestBed
.
createComponent
(
BlogView
);
comp
=
fixture
.
componentInstance
;
comp
.
blog
=
blog
;
fixture
.
detectChanges
();
});
afterEach
(()
=>
{
jasmine
.
clock
().
uninstall
();
});
it
(
'
should have an instance of m-social-icons if the owner has it enabled
'
,
()
=>
{
let
socialIcons
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-social-icons
'
));
expect
(
socialIcons
).
not
.
toBeNull
();
const
blog
=
Object
.
assign
({},
comp
.
blog
);
blog
.
ownerObj
.
hide_share_buttons
=
true
;
comp
.
blog
=
blog
;
fixture
.
detectChanges
();
socialIcons
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-social-icons
'
));
expect
(
socialIcons
).
toBeNull
();
});
});
This diff is collapsed.
src/app/modules/newsfeed/single/single.component.html
View file @
103b2981
...
...
@@ -47,6 +47,6 @@
[url]=
"siteUrl + 'newsfeed/' + activity?.guid"
[title]=
"activity?.title || ''"
[embed]=
"activity"
*ngIf=
"!activity.ownerObj.hide_share_buttons"
*ngIf=
"!activity
?
.ownerObj.hide_share_buttons"
>
</m-social-icons>
This diff is collapsed.
src/app/modules/newsfeed/single/single.component.spec.ts
View file @
103b2981
...
...
@@ -29,6 +29,7 @@ import { featuresServiceMock } from '../../../../tests/features-service-mock.spe
import
{
MetaService
}
from
'
../../../common/services/meta.service
'
;
import
{
ConfigsService
}
from
'
../../../common/services/configs.service
'
;
import
{
SocialIcons
}
from
'
../../legacy/components/social-icons/social-icons
'
;
import
{
metaServiceMock
}
from
'
../../notifications/notification.service.spec
'
;
@
Component
({
selector
:
'
minds-activity
'
,
...
...
@@ -75,7 +76,7 @@ describe('NewsfeedSingleComponent', () => {
},
},
},
{
provide
:
MetaService
,
useValue
:
MockService
(
MetaService
)
},
{
provide
:
MetaService
,
useValue
:
metaServiceMock
},
{
provide
:
Router
,
useValue
:
routerMock
},
{
provide
:
EntitiesService
,
useValue
:
MockService
(
EntitiesService
)
},
{
provide
:
FeaturesService
,
useValue
:
featuresServiceMock
},
...
...
@@ -192,4 +193,19 @@ describe('NewsfeedSingleComponent', () => {
'
If you wish to appeal, please contact us at info@minds.com.
'
);
});
it
(
'
should have an instance of m-social-icons if the owner has it enabled
'
,
()
=>
{
let
socialIcons
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-social-icons
'
));
expect
(
socialIcons
).
not
.
toBeNull
();
const
activity
=
Object
.
assign
({},
comp
.
activity
);
activity
.
ownerObj
.
hide_share_buttons
=
true
;
comp
.
activity
=
activity
;
fixture
.
detectChanges
();
socialIcons
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-social-icons
'
));
expect
(
socialIcons
).
toBeNull
();
});
});
This diff is collapsed.
src/app/modules/notifications/notification.service.spec.ts
View file @
103b2981
...
...
@@ -13,7 +13,12 @@ export let siteServiceMock = new (function() {
var
isAdmin
=
()
=>
true
;
})();
export
let
metaServiceMock
=
new
(
function
()
{
this
.
setCounter
=
jasmine
.
createSpy
(
'
setCounter
'
).
and
.
callFake
(()
=>
{});
this
.
setCounter
=
jasmine
.
createSpy
(
'
setCounter
'
).
and
.
returnValue
(
this
);
this
.
setDescription
=
jasmine
.
createSpy
(
'
setDescription
'
)
.
and
.
returnValue
(
this
);
this
.
setTitle
=
jasmine
.
createSpy
(
'
setTitle
'
).
and
.
returnValue
(
this
);
this
.
setOgImage
=
jasmine
.
createSpy
(
'
setOgImage
'
).
and
.
returnValue
(
this
);
})();
describe
(
'
NotificationService
'
,
()
=>
{
...
...
This diff is collapsed.
Please
register
or
sign in
to comment