diff --git a/app/assets/stylesheets/onboarding.scss b/app/assets/stylesheets/onboarding.scss
index 05732ef20..8560b9ecc 100644
--- a/app/assets/stylesheets/onboarding.scss
+++ b/app/assets/stylesheets/onboarding.scss
@@ -1,7 +1,9 @@
@import 'variables';
+
#onboarding-container {
min-height: calc(100vh - 350px);
}
+
.onboarding-container {
max-width: 800px;
margin: 0 auto;
@@ -40,4 +42,4 @@
input[type='checkbox'] {
display: inline;
}
-}
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/preact/onboarding-modal.scss b/app/assets/stylesheets/preact/onboarding-modal.scss
index 4ecd5d20e..c2e904e87 100644
--- a/app/assets/stylesheets/preact/onboarding-modal.scss
+++ b/app/assets/stylesheets/preact/onboarding-modal.scss
@@ -24,12 +24,15 @@
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
- background-position: center; /* Center the image */
- background-repeat: no-repeat; /* Do not repeat the image */
+ /* Center the image */
+ background-position: center;
+ /* Do not repeat the image */
+ background-repeat: no-repeat;
a {
@include themeable(color, theme-anchor-color, #2e3b9e);
}
+
.sticker-logo {
height: 80px;
width: 80px;
@@ -39,6 +42,7 @@
top: -10px;
padding-top: 5px;
}
+
.onboarding-main {
display: flex;
flex-direction: column;
@@ -61,6 +65,7 @@
width: 100%;
height: 440px;
margin-top: 5px;
+
h1 {
margin-top: 15px;
line-height: 1.1em;
@@ -83,12 +88,15 @@
h1 {
text-align: center;
}
+
h2 {
font-size: 15px;
+
@media screen and (min-width: 600px) {
font-size: 26px;
}
}
+
p {
line-height: 1.25em;
}
@@ -122,6 +130,7 @@
.about {
width: 100%;
+
label,
input,
textarea {
@@ -161,6 +170,7 @@
margin: 8px;
cursor: pointer;
}
+
input[type='checkbox']:checked {
@include themeable(background, theme-anchor-color, #66e2d5);
}
@@ -200,15 +210,19 @@
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol';
+
@media screen and (min-width: 600px) {
width: 255px;
}
+
&.tag-selected {
opacity: 1;
}
+
&:hover {
opacity: 1;
}
+
.onboarding-tag-follow-indicator {
position: absolute;
bottom: 22px;
@@ -221,6 +235,7 @@
.select-all-button-wrapper {
width: 100%;
+
button {
width: 300px;
line-height: 1em;
@@ -243,6 +258,7 @@
margin-right: 5px;
position: relative;
color: $black;
+
.onboarding-user-follow-status {
position: absolute;
color: #32a99c;
@@ -250,17 +266,21 @@
top: 5px;
font-size: 0.88em;
}
+
span {
display: block;
width: 100%;
}
+
p {
font-weight: 400;
height: 55px;
}
+
@media screen and (min-width: 600px) {
width: 365px;
}
+
img {
height: 80px;
width: 80px;
@@ -270,9 +290,11 @@
display: block;
}
}
+
.user:active {
background-color: red;
}
+
.badge-image {
position: absolute;
}
@@ -282,9 +304,11 @@
flex-direction: column;
height: 250px;
overflow: auto;
+
@media screen and (min-width: 600px) {
flex-direction: row;
}
+
a {
background: #d9e7ff;
padding: 15px 4px 0px 12px;
@@ -297,12 +321,14 @@
font-weight: bold;
position: relative;
text-align: center;
+
@media screen and (min-width: 600px) {
height: 220px;
margin: 4px 4px;
text-align: left;
padding: 20px 4px 0px 12px;
- }
+ }
+
.whatnext-emoji {
display: none;
text-align: center;
@@ -311,20 +337,24 @@
left: 0;
right: 0;
font-size: 50px;
+
@media screen and (min-width: 600px) {
display: block;
}
}
}
}
+
.onboarding-previous-location {
text-align: center;
margin-top: 10px;
font-weight: bold;
display: none;
+
@media screen and (min-width: 600px) {
display: block;
}
+
code {
font-size: 0.6em;
margin-top: -10px;
@@ -332,14 +362,17 @@
font-weight: 400;
}
}
+
@media screen and (max-width: 800px) {
.onboarding-main {
width: 100%;
height: 100%;
background-image: url('/assets/mobile-onboarding-background.png');
background-size: cover;
- background-position: center; /* Center the image */
- background-repeat: no-repeat; /* Do not repeat the image */
+ /* Center the image */
+ background-position: center;
+ /* Do not repeat the image */
+ background-repeat: no-repeat;
border: none;
color: $black;
}
@@ -347,7 +380,8 @@
.onboarding-content {
flex: 0 0 auto;
- h1, h2 {
+ h1,
+ h2 {
margin-top: initial;
}
}
@@ -356,7 +390,7 @@
display: block;
}
}
-
+
@media screen and (max-width: 650px) {
.onboarding-main {
font-size: 18px;
@@ -394,4 +428,4 @@
font-size: 20px;
}
}
-}
+}
\ No newline at end of file
diff --git a/app/javascript/src/Onboarding.jsx b/app/javascript/src/Onboarding.jsx
deleted file mode 100644
index 54e7eb328..000000000
--- a/app/javascript/src/Onboarding.jsx
+++ /dev/null
@@ -1,475 +0,0 @@
-import { h, Component } from 'preact';
-import OnboardingWelcome from './components/OnboardingWelcome';
-import OnboardingFollowTags from './components/OnboardingFollowTags';
-import OnboardingFollowUsers from './components/OnboardingFollowUsers';
-import OnboardingWelcomeThread from './components/OnboardingWelcomeThread';
-import cancelSvg from '../../assets/images/cancel.svg';
-import OnboardingProfile from './components/OnboardingProfile';
-
-const getContentOfToken = token =>
- document.querySelector(`meta[name='${token}']`).content;
-const getFormDataAndAppend = array => {
- const form = new FormData();
- array.forEach(item => form.append(item.key, item.value));
- return form;
-};
-
-class Onboarding extends Component {
- constructor() {
- super();
- this.handleNextButton = this.handleNextButton.bind(this);
- this.handleBackButton = this.handleBackButton.bind(this);
- this.closeOnboarding = this.closeOnboarding.bind(this);
- this.handleFollowTag = this.handleFollowTag.bind(this);
- this.handleNextHover = this.handleNextHover.bind(this);
- this.updateUserData = this.updateUserData.bind(this);
- this.getUserTags = this.getUserTags.bind(this);
- this.handleCheckAllUsers = this.handleCheckAllUsers.bind(this);
- this.handleCheckUser = this.handleCheckUser.bind(this);
- this.handleSaveAllArticles = this.handleSaveAllArticles.bind(this);
- this.handleSaveArticle = this.handleSaveArticle.bind(this);
- this.handleProfileChange = this.handleProfileChange.bind(this);
- this.getUsersToFollow = this.getUsersToFollow.bind(this);
- this.state = {
- pageNumber: 1,
- showOnboarding: false,
- userData: null,
- allTags: [],
- users: [],
- checkedUsers: [],
- followRequestSent: false,
- articles: [],
- savedArticles: [],
- profileInfo: {},
- };
- }
-
- componentDidMount() {
- this.updateUserData();
- this.getUserTags();
- document.getElementsByTagName('body')[0].classList.add('modal-open');
- }
-
- getUserTags() {
- fetch('/api/tags/onboarding')
- .then(response => response.json())
- .then(json => {
- const followedTagNames = JSON.parse(
- document.body.getAttribute('data-user'),
- ).followed_tag_names;
- function checkFollowingStatus(followedTags, jsonTags) {
- if (!followedTags || !followedTags.length) return jsonTags;
- const newJSON = jsonTags;
- jsonTags.map((tag, index) => {
- if (followedTags.includes(tag.name)) {
- newJSON[index].following = true;
- } else {
- newJSON[index].following = false;
- }
- return newJSON;
- });
- return newJSON;
- }
- const updatedJSON = checkFollowingStatus(followedTagNames, json);
- this.setState({ allTags: updatedJSON });
- })
- .catch(error => {
- console.log(error);
- });
- }
-
- getUsersToFollow() {
- const { users } = this.state;
- fetch('/api/users?state=follow_suggestions', {
- headers: {
- Accept: 'application/json',
- 'Content-Type': 'application/json',
- },
- credentials: 'same-origin',
- })
- .then(response => response.json())
- .then(json => {
- if (users.length === 0) {
- this.setState({ users: json, checkedUsers: json });
- }
- })
- .catch(error => {
- console.log(error);
- });
- }
-
- handleBulkFollowUsers(users) {
- const { checkedUsers, followRequestSent } = this.state;
- if (checkedUsers.length > 0 && !followRequestSent) {
- const csrfToken = getContentOfToken('csrf-token');
- const formData = getFormDataAndAppend([
- { key: 'users', value: JSON.stringify(users) },
- ]);
-
- fetch('/api/follows', {
- method: 'POST',
- headers: {
- 'X-CSRF-Token': csrfToken,
- },
- body: formData,
- credentials: 'same-origin',
- }).then(response => {
- if (response.ok) {
- this.setState({ followRequestSent: true });
- }
- });
- }
- }
-
- handleUserProfileSave() {
- const csrfToken = getContentOfToken('csrf-token');
- const { profileInfo } = this.state;
- const formData = getFormDataAndAppend([
- { key: 'user', value: JSON.stringify(profileInfo) },
- ]);
- fetch('/onboarding_update', {
- method: 'PATCH',
- headers: {
- 'X-CSRF-Token': csrfToken,
- },
- body: formData,
- credentials: 'same-origin',
- });
- }
-
- updateUserData() {
- const userData = JSON.parse(document.body.getAttribute('data-user'));
- const { saw_onboarding: sawOnboarding } = userData;
- this.setState({
- userData,
- showOnboarding: !sawOnboarding,
- });
- }
-
- handleFollowTag(tag) {
- const csrfToken = getContentOfToken('csrf-token');
- const formData = getFormDataAndAppend([
- { key: 'followable_type', value: 'Tag' },
- { key: 'followable_id', value: tag.id },
- { key: 'verb', value: tag.following ? 'unfollow' : 'follow' },
- ]);
-
- this.setState(prevState => ({
- allTags: prevState.allTags.map(currentTag => {
- const newTag = currentTag;
- if (currentTag.name === tag.name) {
- newTag.following = true;
- }
- return newTag;
- }),
- }));
-
- fetch('/follows', {
- method: 'POST',
- headers: {
- 'X-CSRF-Token': csrfToken,
- },
- body: formData,
- credentials: 'same-origin',
- })
- .then(response =>
- response.json().then(json => {
- this.setState(prevState => ({
- allTags: prevState.allTags.map(currentTag => {
- const newTag = currentTag;
- if (currentTag.name === tag.name) {
- newTag.following = json.outcome === 'followed';
- }
- return newTag;
- // add in optimistic rendering
- }),
- }));
- }),
- )
- .catch(error => {
- console.log(error);
- });
- }
-
- handleCheckAllUsers() {
- const { users, checkedUsers: prevCheckedUsers } = this.state;
- let checkedUsers = [];
-
- if (prevCheckedUsers.length < users.length) {
- checkedUsers = users.slice();
- }
- this.setState({ checkedUsers });
- }
-
- handleProfileChange(event) {
- const { name, value } = event.target;
-
- this.setState(prevState => ({
- profileInfo: {
- ...prevState.profileInfo,
- [name]: value,
- },
- }));
- }
-
- handleCheckUser(user) {
- const { checkedUsers } = this.state;
- const newCheckedUsers = checkedUsers.slice();
- const index = checkedUsers.indexOf(user);
-
- if (index > -1) {
- newCheckedUsers.splice(index, 1);
- } else {
- newCheckedUsers.push(user);
- }
- this.setState({ checkedUsers: newCheckedUsers });
- }
-
- handleSaveAllArticles() {
- const { savedArticles: prevSavedArticles, articles } = this.state;
- let savedArticles = [];
- if (prevSavedArticles.length < articles.length) {
- savedArticles = articles.slice();
- }
- this.setState({ savedArticles });
- }
-
- handleSaveArticle(article) {
- const { savedArticles } = this.state;
- const newSavedArticles = savedArticles.slice();
- const index = newSavedArticles.indexOf(article);
- if (index > -1) {
- newSavedArticles.splice(index, 1);
- } else {
- newSavedArticles.push(article);
- }
- this.setState({ savedArticles: newSavedArticles });
- }
-
- handleNextHover() {
- const { pageNumber, users } = this.state;
- if (pageNumber === 2 && users.length === 0) {
- this.getUsersToFollow();
- }
- }
-
- handleNextButton() {
- const { users, articles, checkedUsers, profileInfo } = this.state;
- let { pageNumber } = this.state;
- if (pageNumber === 2 && users.length === 0 && articles.length === 0) {
- this.getUsersToFollow();
- }
- if (pageNumber < 5) {
- pageNumber += 1;
- this.setState({ pageNumber });
- if (pageNumber === 4 && checkedUsers.length > 0) {
- this.handleBulkFollowUsers(checkedUsers);
- } else if (pageNumber === 5) {
- this.handleUserProfileSave(profileInfo);
- }
- } else if (pageNumber === 5) {
- this.closeOnboarding();
- }
- }
-
- handleBackButton() {
- const { pageNumber } = this.state;
- if (pageNumber > 1) {
- this.setState({ pageNumber: pageNumber - 1 });
- }
- }
-
- closeOnboarding() {
- const { pageNumber } = this.state;
- document.getElementsByTagName('body')[0].classList.remove('modal-open');
- const csrfToken = getContentOfToken('csrf-token');
- const formData = getFormDataAndAppend([
- { key: 'saw_onboarding', value: true },
- ]);
-
- if (window.ga && ga.create) {
- ga('send', 'event', 'click', 'close onboarding slide', pageNumber, null);
- }
- fetch('/onboarding_update', {
- method: 'PATCH',
- headers: {
- 'X-CSRF-Token': csrfToken,
- },
- body: formData,
- credentials: 'same-origin',
- })
- .then(response => response.json())
- .then(json => {
- this.setState({ showOnboarding: json.outcome === 'onboarding opened' });
- // console.log('this is special')
- // console.log(this.state)
- })
- .catch(error => {
- console.log(error);
- });
- }
-
- toggleOnboardingSlide() {
- const ONBOARDING = {
- WELCOME_SCREEN: 1,
- FOLLOW_TAG_SCREEN: 2,
- FOLLOW_USERS_SCREEN: 3,
- PROFILE_SCREEN: 4,
- WELCOME_THREAD: 5,
- };
-
- const {
- pageNumber,
- userData,
- allTags,
- followedTags,
- users,
- checkedUsers,
- } = this.state;
- switch (pageNumber) {
- case ONBOARDING.WELCOME_SCREEN:
- return ;
- case ONBOARDING.FOLLOW_TAG_SCREEN:
- return (
-
- );
- case ONBOARDING.FOLLOW_USERS_SCREEN:
- return (
-
- );
- case ONBOARDING.PROFILE_SCREEN:
- return ;
- case ONBOARDING.WELCOME_THREAD:
- return ;
- default:
- return null;
- }
- }
-
- renderCloseButton() {
- const btnClassName = 'close-button';
- return (
-
-
-
- );
- }
-
- renderBackButton() {
- const { pageNumber } = this.state;
- if (pageNumber > 1) {
- return (
-
- BACK
-
- );
- }
- return null;
- }
-
- renderNextButton() {
- const { pageNumber } = this.state;
- return (
-
- {pageNumber < 5 ? 'NEXT' : "LET'S GO"}
-
- );
- }
-
- renderPageIndicators() {
- const { pageNumber } = this.state;
- const firstIndicatorClassName =
- pageNumber === 2
- ? 'pageindicator pageindicator--active'
- : 'pageindicator';
- const secondIndicatorClassName =
- pageNumber === 3
- ? 'pageindicator pageindicator--active'
- : 'pageindicator';
- const thirdIndicatorClassName =
- pageNumber === 4
- ? 'pageindicator pageindicator--active'
- : 'pageindicator';
- return (
-
- );
- }
-
- renderSloanMessage() {
- const messages = {
- 1: 'WELCOME!',
- 2: 'FOLLOW TAGS',
- 3: 'FOLLOW DEVS',
- 4: 'CREATE YOUR PROFILE',
- 5: 'GET INVOLVED',
- };
- const { pageNumber } = this.state;
-
- return messages[pageNumber];
- }
-
- render() {
- const { showOnboarding } = this.state;
- if (!showOnboarding) return null;
-
- return (
-
-
{this.renderCloseButton()}
-
-
-
- {this.renderSloanMessage()}
-
-
-
-
-
-
-
{this.toggleOnboardingSlide()}
-
-
-
{this.renderBackButton()}
-
- {this.renderPageIndicators()}
-
-
{this.renderNextButton()}
-
-
-
- );
- }
-}
-
-export default Onboarding;
diff --git a/app/javascript/src/__tests__/Onboarding.test.jsx b/app/javascript/src/__tests__/Onboarding.test.jsx
deleted file mode 100644
index 064091610..000000000
--- a/app/javascript/src/__tests__/Onboarding.test.jsx
+++ /dev/null
@@ -1,318 +0,0 @@
-import { h } from 'preact';
-import { shallow, deep } from 'preact-render-spy';
-import fetch from 'jest-fetch-mock';
-import Onboarding from '../Onboarding';
-
-global.fetch = fetch;
-
-function flushPromises() {
- return new Promise(resolve => setImmediate(resolve));
-}
-
-describe(' ', () => {
- beforeEach(() => {
- document.body.setAttribute('data-user', null);
- fetch.resetMocks();
- });
-
- const fakeTagResponse = JSON.stringify([
- {
- bg_color_hex: '#000000',
- id: 715,
- name: 'discuss',
- text_color_hex: '#ffffff',
- },
- {
- bg_color_hex: '#f7df1e',
- id: 6,
- name: 'javascript',
- text_color_hex: '#000000',
- },
- {
- bg_color_hex: '#2a2566',
- id: 630,
- name: 'career',
- text_color_hex: '#ffffff',
- },
- ]);
-
- const dataUser = JSON.stringify({
- followed_tag_names: ['javascript'],
- });
-
- const fakeUsersToFollowResponse = JSON.stringify([
- {
- id: 1,
- name: 'Ben Halpern',
- profile_image_url: 'ben.jpg',
- },
- {
- id: 2,
- name: 'Krusty the Clown',
- profile_image_url: 'clown.jpg',
- },
- {
- id: 3,
- name: 'dev.to staff',
- profile_image_url: 'dev.jpg',
- },
- ]);
-
- describe('when user is not logged in', () => {
- beforeEach(() => {
- fetch.once(fakeTagResponse);
- document.body.setAttribute(
- 'data-user',
- JSON.stringify({ saw_onboarding: true }),
- );
- });
-
- test('showOnboarding is false', () => {
- const context = shallow( );
- expect(context.state('showOnboarding')).toEqual(false);
- });
-
- test('nothing should be rendered', async () => {
- // TODO: dataUser should be {};
- const context = shallow( );
- await flushPromises();
- expect(context).toMatchSnapshot();
- });
- });
-
- describe('Welcome page', () => {
- let context;
- beforeEach(async () => {
- fetch.once(fakeTagResponse);
- document.body.setAttribute('data-user', dataUser);
- context = deep( );
- await flushPromises();
- });
-
- test('renders properly', () => {
- expect(context).toMatchSnapshot();
- });
-
- test('NEXT button should work', () => {
- context.find('.button').simulate('click');
- expect(context.state('pageNumber')).toEqual(2);
- expect(context).toMatchSnapshot();
- });
-
- // TODO: test closing button
- });
-
- describe('Follow tag page', () => {
- let context;
- const meta = document.createElement('meta');
- meta.setAttribute('name', 'csrf-token');
- document.body.appendChild(meta);
-
- beforeEach(async () => {
- fetch.once(fakeTagResponse);
- document.body.setAttribute('data-user', dataUser);
- context = deep( );
- context.setState({ pageNumber: 2 });
- await flushPromises();
- });
-
- test('renders properly', () => {
- expect(context).toMatchSnapshot();
- });
-
- test('BACK button works', () => {
- context
- .find('.button')
- .at(0)
- .simulate('click');
- expect(context.state('pageNumber')).toEqual(1);
- expect(context).toMatchSnapshot();
- });
-
- test('NEXT button works', async () => {
- fetch.once(fakeUsersToFollowResponse);
- context
- .find('.button')
- .at(1)
- .simulate('click');
- await flushPromises();
- expect(context.state('pageNumber')).toEqual(3);
- expect(context).toMatchSnapshot();
- });
-
- test('each tag can be clicked', async () => {
- fetch.mockResponse(JSON.stringify({ outcome: 'followed' }));
- context.find('.onboarding-tag-link').map(tag => tag.simulate('click'));
- await flushPromises();
- expect(context.state('allTags').map(tag => tag.following)).toEqual([
- true,
- true,
- true,
- ]);
- });
-
- test('each tag can be clicked (in weird combinations)', async () => {
- fetch.mockResponse(JSON.stringify({ outcome: 'followed' }));
- context
- .find('.onboarding-tag-link')
- .at(1)
- .simulate('click');
- await flushPromises();
- expect(context.state('allTags').map(tag => tag.following)).toEqual([
- false,
- true,
- false,
- ]);
- });
- });
-
- describe('Follow dev members page', () => {
- let context;
- beforeEach(async () => {
- fetch.once(fakeTagResponse);
- document.body.setAttribute('data-user', dataUser);
- context = deep( );
- fetch.once(fakeUsersToFollowResponse);
- context.setState({ pageNumber: 2 });
- context
- .find('.button')
- .at(1)
- .simulate('click');
- await flushPromises();
- });
-
- test('renders properly', () => {
- expect(context).toMatchSnapshot();
- });
-
- test('BACK button works', () => {
- context
- .find('.button')
- .at(0)
- .simulate('click');
- expect(context.state('pageNumber')).toEqual(2);
- expect(context).toMatchSnapshot();
- });
-
- test('NEXT button works', async () => {
- fetch.once(JSON.stringify({}));
- context
- .find('.button')
- .at(1)
- .simulate('click');
- await flushPromises();
- expect(context.state('pageNumber')).toEqual(4);
- expect(context).toMatchSnapshot();
- });
- });
-
- describe('User info page', () => {
- let context;
- beforeEach(async () => {
- fetch.once(fakeTagResponse);
- document.body.setAttribute('data-user', dataUser);
- context = deep( );
- context.setState({ pageNumber: 4 });
- await flushPromises();
- });
-
- test('renders properly', () => {
- expect(context).toMatchSnapshot();
- });
-
- test('NEXT button works', async () => {
- fetch.once({});
- context
- .find('.button')
- .at(1)
- .simulate('click');
- await flushPromises();
- expect(context.state('pageNumber')).toEqual(5);
- });
-
- test('BACK button works', () => {
- context
- .find('.button')
- .at(0)
- .simulate('click');
- expect(context.state('pageNumber')).toEqual(3);
- });
-
- test('forms can be filled and submitted', async () => {
- fetch.once({});
- const targets = [
- 'summary',
- 'location',
- 'employment_title',
- 'employer_name',
- 'mostly_work_with',
- 'currently_learning',
- ];
- const findAndUpdate = target => {
- // TODO: we shouldn't have to add name. This might have to do with preact-render-spy
- const event = { target: { value: 'TEST', name: target } };
- context.find( ).simulate('change', event);
- };
-
- targets.forEach(findAndUpdate);
- context
- .find('.button')
- .at(1)
- .simulate('click');
- await flushPromises();
- expect(context.state('pageNumber')).toEqual(5);
- const idealResult = {};
- targets.forEach(attr => {
- idealResult[attr] = 'TEST';
- });
- expect(context.state('profileInfo')).toEqual(idealResult);
- });
- });
-
- describe('Final page', () => {
- let context;
- beforeEach(async () => {
- fetch.once(fakeTagResponse);
- document.body.setAttribute('data-user', dataUser);
- const meta = document.createElement('meta');
- meta.setAttribute('name', 'csrf-token');
- document.body.appendChild(meta);
- context = deep( );
- context.setState({ pageNumber: 5, profileInfo: { summary: 'hi there' } });
- await flushPromises();
- });
-
- it('renders properly', () => {
- expect(context).toMatchSnapshot();
- });
-
- it('special next button exists and should reroute user', async () => {
- fetch.once(JSON.stringify({ outcome: 'onboarding closed' }));
- const next = context.find('.button').at(1);
- expect(next.text()).toEqual("LET'S GO");
- next.simulate('click');
- await flushPromises();
- expect(context.state('pageNumber')).toEqual(5);
- expect(context).toMatchSnapshot();
- });
-
- it('sends proper update on close', async () => {
- fetch.once(JSON.stringify({ outcome: 'onboarding closed' }));
- context
- .find('.button')
- .at(1)
- .simulate('click');
- await flushPromises();
- expect(context.state('showOnboarding')).toEqual(false);
- });
-
- it('BACK button works', () => {
- context
- .find('.button')
- .at(0)
- .simulate('click');
- expect(context.state('pageNumber')).toEqual(4);
- expect(context).toMatchSnapshot();
- });
- });
-});
diff --git a/app/javascript/src/__tests__/__snapshots__/Onboarding.test.jsx.snap b/app/javascript/src/__tests__/__snapshots__/Onboarding.test.jsx.snap
deleted file mode 100644
index f0457969b..000000000
--- a/app/javascript/src/__tests__/__snapshots__/Onboarding.test.jsx.snap
+++ /dev/null
@@ -1,1336 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` Final page BACK button works 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Tell the us a bit about yourself ❤️
-
What's your quick bio?
-
-
Where are you located?
-
-
What is your title?
-
-
Where do you work?
-
-
What are your core skills/languages?
-
-
- What are you currently learning/playing with?
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Final page renders properly 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Software is driven by community.
-
- Don't hesitate to find a discussion and jump right in.
-
-
- Everyone is welcome!
-
-
-
-
-
-
-
-
-`;
-
-exports[` Final page special next button exists and should reroute user 1`] = `
-preact-render-spy (1 nodes)
--------
-{null}
-
-`;
-
-exports[` Follow dev members page BACK button works 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Follow dev members page NEXT button works 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Tell the us a bit about yourself ❤️
-
What's your quick bio?
-
-
Where are you located?
-
-
What is your title?
-
-
Where do you work?
-
-
What are your core skills/languages?
-
-
- What are you currently learning/playing with?
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Follow dev members page renders properly 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Here are some suggestions based on your interests
-
-
-
-
-
-
-
-
Ben Halpern
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
-
Krusty the Clown
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
-
dev.to staff
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Follow tag page BACK button works 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Thank you for joining the DEV Community.
-
- Keep up with the people and software trends you care about. ❤️
-
-
-
- Let's get started!
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Follow tag page NEXT button works 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Here are some suggestions based on your interests
-
-
-
-
-
-
-
-
Ben Halpern
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
-
Krusty the Clown
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
-
dev.to staff
-
-
-
-
-
-
- ✓
-
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Follow tag page renders properly 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` User info page renders properly 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Tell the us a bit about yourself ❤️
-
What's your quick bio?
-
-
Where are you located?
-
-
What is your title?
-
-
Where do you work?
-
-
What are your core skills/languages?
-
-
- What are you currently learning/playing with?
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Welcome page NEXT button should work 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` Welcome page renders properly 1`] = `
-preact-render-spy (1 nodes)
--------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Thank you for joining the DEV Community.
-
- Keep up with the people and software trends you care about. ❤️
-
-
-
- Let's get started!
-
-
-
-
-
-
-
-
-
-`;
-
-exports[` when user is not logged in nothing should be rendered 1`] = `
-preact-render-spy (1 nodes)
--------
-{null}
-
-`;
diff --git a/app/javascript/src/components/ItemList/ItemListTags.jsx b/app/javascript/src/components/ItemList/ItemListTags.jsx
index 7234c7fca..42226de1f 100644
--- a/app/javascript/src/components/ItemList/ItemListTags.jsx
+++ b/app/javascript/src/components/ItemList/ItemListTags.jsx
@@ -10,7 +10,8 @@ export const ItemListTags = ({ availableTags, selectedTags, onClick }) => {
data-no-instant
onClick={e => onClick(e, tag)}
>
- #{tag}
+ #
+ {tag}
));
return {tagsHTML}
;
diff --git a/app/javascript/src/components/OnboardingArticle.jsx b/app/javascript/src/components/OnboardingArticle.jsx
deleted file mode 100644
index 3f4fcd01a..000000000
--- a/app/javascript/src/components/OnboardingArticle.jsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { h } from 'preact';
-import PropTypes from 'prop-types';
-import { userPropTypes } from './common-prop-types';
-
-const MAX_ARTICLE_DESCRIPTION_LENGTH = 75;
-
-export const ARTICLE_PROP_TYPE = {
- user: userPropTypes,
- title: PropTypes.string.isRequired,
- description: PropTypes.string.isRequired,
- positive_reactions_count: PropTypes.number.isRequired,
- comments_count: PropTypes.number.isRequired,
-};
-
-const OnboardingArticle = ({ article, isSaved, onSaveArticle }) => (
-
-
-
{article.title}
-
-
{article.user.name}
-
- {article.description.length < MAX_ARTICLE_DESCRIPTION_LENGTH
- ? article.description
- : `${article.description.substring(
- 0,
- MAX_ARTICLE_DESCRIPTION_LENGTH,
- )}...`}
-
-
-
- {' '}
- {article.positive_reactions_count}
-
- {' '}
- {article.comments_count}
-
-
-
-
- {isSaved ? 'SAVED' : 'SAVE'}
-
-
-
-);
-
-OnboardingArticle.propTypes = {
- article: PropTypes.shape(ARTICLE_PROP_TYPE).isRequired,
- isSaved: PropTypes.bool.isRequired,
- onSaveArticle: PropTypes.func.isRequired,
-};
-
-export default OnboardingArticle;
diff --git a/app/javascript/src/components/OnboardingArticles.jsx b/app/javascript/src/components/OnboardingArticles.jsx
deleted file mode 100644
index 05a5b50d6..000000000
--- a/app/javascript/src/components/OnboardingArticles.jsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { h, Component } from 'preact';
-import PropTypes from 'prop-types';
-import OnboardingArticle, { ARTICLE_PROP_TYPE } from './OnboardingArticle';
-
-class OnboardingArticles extends Component {
- constructor(props) {
- super(props);
- this.handleAllClick = this.handleAllClick.bind(this);
- }
-
- handleAllClick() {
- this.props.handleSaveAllArticles();
- }
-
- render() {
- const { articles, savedArticles, handleSaveArticle } = this.props;
- const onboardingArticles = articles.map(article => (
- -1}
- // eslint-disable-next-line react/jsx-no-bind
- onSaveArticle={handleSaveArticle.bind(this, article)}
- />
- ));
- const areAllSaved = savedArticles.length === articles.length;
-
- return (
-
-
- When you see an interesting post, you can
- {' '}
- SAVE
- {' '}
-it. To get started, here are
- pre-selected suggestions.
-
-
-
-
Save All
-
-
- {areAllSaved ? '✓' : '+'}
-
-
-
-
{onboardingArticles}
-
-
- );
- }
-}
-
-OnboardingArticles.propTypes = {
- articles: PropTypes.arrayOf(PropTypes.shape(ARTICLE_PROP_TYPE)).isRequired,
- savedArticles: PropTypes.arrayOf(PropTypes.shape(ARTICLE_PROP_TYPE))
- .isRequired,
- handleSaveArticle: PropTypes.func.isRequired,
- handleSaveAllArticles: PropTypes.func.isRequired,
-};
-
-export default OnboardingArticles;
diff --git a/app/javascript/src/components/OnboardingFollowTags.jsx b/app/javascript/src/components/OnboardingFollowTags.jsx
deleted file mode 100644
index fa1073111..000000000
--- a/app/javascript/src/components/OnboardingFollowTags.jsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { h } from 'preact';
-import OnboardingTags from './OnboardingTags';
-
-// component of page 2
-const OnboardingFollowTags = ({ userData, allTags, followedTags, handleFollowTag }) => (
-
-);
-
-export default OnboardingFollowTags;
diff --git a/app/javascript/src/components/OnboardingFollowUsers.jsx b/app/javascript/src/components/OnboardingFollowUsers.jsx
deleted file mode 100644
index 3bd056bcb..000000000
--- a/app/javascript/src/components/OnboardingFollowUsers.jsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { h } from 'preact';
-import OnboardingUsers from './OnboardingUsers';
-
-const OnboardingFollowUsers = ({ users, checkedUsers, handleCheckUser, handleCheckAllUsers }) => (
-
-);
-
-export default OnboardingFollowUsers;
diff --git a/app/javascript/src/components/OnboardingProfile.jsx b/app/javascript/src/components/OnboardingProfile.jsx
deleted file mode 100644
index d8bb99ea0..000000000
--- a/app/javascript/src/components/OnboardingProfile.jsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import { h, render, Component } from 'preact';
-
-// page 1
-const OnboardingProfile = ({ onChange }) => {
- return (
-
-
- Tell the us a bit about yourself ❤️
-
-
What's your quick bio?
-
-
Where are you located?
-
-
What is your title?
-
-
Where do you work?
-
-
- What are your core skills/languages?
-
-
-
- What are you currently learning/playing with?
-
-
-
- );
-};
-
-export default OnboardingProfile;
diff --git a/app/javascript/src/components/OnboardingSingleTag.jsx b/app/javascript/src/components/OnboardingSingleTag.jsx
deleted file mode 100644
index 5bf1da813..000000000
--- a/app/javascript/src/components/OnboardingSingleTag.jsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { h, Component } from 'preact';
-import PropTypes from 'prop-types';
-
-class OnboardingSingleTag extends Component {
- propTypes = {
- onTagClick: PropTypes.func.isRequired,
- tag: PropTypes.objectOf().isRequired,
- };
-
- constructor(props) {
- super(props);
- this.onClick = this.onClick.bind(this);
- }
-
- onClick() {
- const { onTagClick, tag } = this.props;
- onTagClick(tag);
- }
-
- render() {
- const { tag } = this.props;
- const backgroundColor = tag.following ? tag.bg_color_hex : '';
- const textroundColor = tag.following ? tag.text_color_hex : '';
- return (
-
- );
- }
-}
-
-export default OnboardingSingleTag;
diff --git a/app/javascript/src/components/OnboardingTags.jsx b/app/javascript/src/components/OnboardingTags.jsx
deleted file mode 100644
index 3ad197254..000000000
--- a/app/javascript/src/components/OnboardingTags.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { h } from 'preact';
-import PropTypes from 'prop-types';
-import OnboardingSingleTag from './OnboardingSingleTag';
-
-// page 2
-function OnboardingTags({ allTags, handleFollowTag }) {
- const tags = allTags.map(tag => {
- return (
-
- );
- });
-
- return (
-
-
Personalize your home feed
-
{tags}
-
- );
-}
-
-OnboardingTags.propTypes = {
- handleFollowTag: PropTypes.func.isRequired,
- allTags: PropTypes.objectOf().isRequired,
-};
-
-export default OnboardingTags;
diff --git a/app/javascript/src/components/OnboardingUsers.jsx b/app/javascript/src/components/OnboardingUsers.jsx
deleted file mode 100644
index 3547f5408..000000000
--- a/app/javascript/src/components/OnboardingUsers.jsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { h, render, Component } from 'preact';
-import PropTypes from 'prop-types';
-
-class OnboardingUsers extends Component {
- constructor(props) {
- super(props);
- this.handleAllClick = this.handleAllClick.bind(this);
- }
-
- handleAllClick() {
- this.props.handleCheckAllUsers();
- }
-
- render() {
- const followList = this.props.users.map(user => {
- return (
-
-
-
-
{user.name}
-
- {user.summary}
-
-
-
- -1 ? 'checked' : ''
- }
- >
- {this.props.checkedUsers.indexOf(user) > -1 ? '✓' : '+'}
-
-
-
- );
- });
- const renderLoadingOrList = () => {
- if (this.props.users.length === 0) {
- return Loading...
;
- }
- return followList;
- };
-
- return (
-
-
- Here are some suggestions based on your interests
-
-
-
-
Follow All
-
-
- {this.props.checkedUsers.length === this.props.users.length
- ? '✓'
- : '+'}
-
-
-
-
- {renderLoadingOrList()}
-
-
-
- );
- }
-}
-
-OnboardingUsers.propTypes = {
- handleCheckUser: PropTypes.func.isRequired,
- handleCheckAllUsers: PropTypes.func.isRequired,
-};
-
-export default OnboardingUsers;
diff --git a/app/javascript/src/components/OnboardingWelcome.jsx b/app/javascript/src/components/OnboardingWelcome.jsx
deleted file mode 100644
index 9967ac6dd..000000000
--- a/app/javascript/src/components/OnboardingWelcome.jsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { h, render, Component } from 'preact';
-
-// page 1
-const OnboardingWelcome = () => {
- const messages = [
- 'Thank you for joining the DEV Community.',
- 'Keep up with the people and software trends you care about. ❤️',
- ];
-
- const specialMessage = "Let's get started!";
-
- return (
-
- {messages.map(item => (
-
{item}
- ))}
-
-
- {specialMessage}
-
-
-
- );
-};
-
-export default OnboardingWelcome;
diff --git a/app/javascript/src/components/OnboardingWelcomeThread.jsx b/app/javascript/src/components/OnboardingWelcomeThread.jsx
deleted file mode 100644
index 05c13fb2d..000000000
--- a/app/javascript/src/components/OnboardingWelcomeThread.jsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import { h } from 'preact';
-
-const OnboardingWelcomeThread = () => {
- const wrapInYellow = message => {message} ;
-
- return (
-
-
Software is driven by community.
-
Don't hesitate to find a discussion and jump right in.
-
- Everyone is welcome!
-
-
- );
-};
-
-export default OnboardingWelcomeThread;
diff --git a/app/javascript/src/components/__stories__/OnboardingArticle.stories.jsx b/app/javascript/src/components/__stories__/OnboardingArticle.stories.jsx
deleted file mode 100644
index d771ef4d6..000000000
--- a/app/javascript/src/components/__stories__/OnboardingArticle.stories.jsx
+++ /dev/null
@@ -1,144 +0,0 @@
-import { h } from 'preact';
-import { storiesOf } from '@storybook/react';
-import { action } from '@storybook/addon-actions';
-import faker from 'faker';
-import GlobalModalWrapper from './GlobalModalWrapper';
-import OnboardingArticle from '../OnboardingArticle';
-import { defaultChildrenPropTypes } from '../common-prop-types';
-
-const article = {
- user: {
- id: faker.internet.userName(),
- name: faker.name.firstName(),
- profile_image_url: './images/storm-trooper-33x33.png',
- },
- description: faker.random.words(5),
- title: faker.random.words(2),
- positive_reactions_count: 100,
- comments_count: 8,
-};
-
-const commonProps = {
- article,
- isSaved: false,
- onSaveArticle: action('Saving article'),
-};
-
-const ArticleWrapper = ({ children }) => (
-
-);
-
-ArticleWrapper.propTypes = {
- // Diabling linting below because of https://github.com/yannickcr/eslint-plugin-react/issues/1389
- // eslint-disable-next-line react/no-typos
- children: defaultChildrenPropTypes.isRequired,
-};
-
-storiesOf('Onboarding/OnboardingArticle', module)
- .addDecorator(storyFn => (
-
- {storyFn()}
-
- ))
- .add('Already saved article', () => (
-
- ))
- .add('Short title', () => )
- .add('Medium length title', () => (
-
- ))
- .add('Long title', () => (
-
- ))
- .add('Short description', () => (
-
- ))
- .add('Medium length description', () => (
-
- ))
- .add('Long description', () => (
-
- ))
- .add('No reactions/comments count', () => (
-
- ))
- .add('10 reactions/comments', () => (
-
- ))
- .add('999 reactions/comments', () => (
-
- ))
- .add('9999 reactions/comments', () => (
-
- ))
- .add('99999 reactions/comments', () => (
-
- ))
- .add('999999 reactions/comments', () => (
-
- ));
diff --git a/app/javascript/src/components/__stories__/OnboardingArticles.stories.jsx b/app/javascript/src/components/__stories__/OnboardingArticles.stories.jsx
deleted file mode 100644
index e8fa639c4..000000000
--- a/app/javascript/src/components/__stories__/OnboardingArticles.stories.jsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import { h } from 'preact';
-import { storiesOf } from '@storybook/react';
-import { action } from '@storybook/addon-actions';
-import faker from 'faker';
-import { globalModalDecorator } from './story-decorators';
-import OnboardingArticles from '../OnboardingArticles';
-
-const getArticles = (numberOfArticles = 5) =>
- new Array(numberOfArticles).fill('').map(() => ({
- user: {
- id: faker.internet.userName(),
- name: faker.name.firstName(),
- profile_image_url: './images/storm-trooper-33x33.png',
- },
- description: faker.random.words(5),
- title: faker.random.words(2),
- positive_reactions_count: faker.random.number(),
- comments_count: faker.random.number(),
- }));
-const unsavedArticles = getArticles();
-const commonProps = {
- articles: unsavedArticles,
- savedArticles: unsavedArticles.slice(),
- handleSaveArticle: action('Handling save article'),
- handleSaveAllArticles: action('Saving all articles'),
-};
-
-storiesOf('Onboarding/OnboardingArticles', module)
- .addDecorator(globalModalDecorator)
- .add('All articles saved', () => )
- .add('Some unsaved articles', () => {
- const { articles } = commonProps;
- const savedArticles = articles.slice(0, 1).concat(articles.slice(3));
-
- return (
-
- );
- })
- .add('20 articles articles', () => {
- const articles = getArticles(20);
- const savedArticles = articles.slice(0, 5).concat(articles.slice(10, 13));
-
- return (
-
- );
- })
- .add('100 articles', () => {
- const articles = getArticles(100);
- const savedArticles = articles.slice(0, 5).concat(articles.slice(10, 13));
-
- return (
-
- );
- })
- .add('500 articles', () => {
- const articles = getArticles(500);
- const savedArticles = articles.slice(0, 5).concat(articles.slice(10, 13));
-
- return (
-
- );
- })
- .add('1000 articles', () => {
- const articles = getArticles(1000);
- const savedArticles = articles.slice(0, 5).concat(articles.slice(10, 13));
-
- return (
-
- );
- });
diff --git a/app/javascript/src/components/__stories__/OnboardingWelcome.stories.jsx b/app/javascript/src/components/__stories__/OnboardingWelcome.stories.jsx
deleted file mode 100644
index 0df13fa4f..000000000
--- a/app/javascript/src/components/__stories__/OnboardingWelcome.stories.jsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { h } from 'preact';
-import { storiesOf } from '@storybook/react';
-import { globalModalDecorator } from './story-decorators';
-import OnboardingWelcome from '../OnboardingWelcome';
-
-storiesOf('OnboardingWelcome', module)
- .addDecorator(globalModalDecorator)
- .add('Default', () => );
diff --git a/app/javascript/src/components/__stories__/OnboardingWelcomeThread.stories.jsx b/app/javascript/src/components/__stories__/OnboardingWelcomeThread.stories.jsx
deleted file mode 100644
index 47b17f7e8..000000000
--- a/app/javascript/src/components/__stories__/OnboardingWelcomeThread.stories.jsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import { h } from 'preact';
-import { storiesOf } from '@storybook/react';
-import { globalModalDecorator } from './story-decorators';
-import OnboardingWelcomeThread from '../OnboardingWelcomeThread';
-
-storiesOf('OnboardingWelcomeThread', module)
- .addDecorator(globalModalDecorator)
- .add('Default', () => );
diff --git a/app/javascript/src/components/__tests__/OnboardingFollowTags.test.jsx b/app/javascript/src/components/__tests__/OnboardingFollowTags.test.jsx
deleted file mode 100644
index 514a1d3c5..000000000
--- a/app/javascript/src/components/__tests__/OnboardingFollowTags.test.jsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { h } from 'preact';
-import render from 'preact-render-to-json';
-import OnboardingFollowTags from '../OnboardingFollowTags';
-
-describe(' ', () => {
- it('renders properly when given a tag', () => {
- const userData = {};
- const allTags = [{
- bg_color_hex: '#000000',
- id: 715,
- name: 'discuss',
- text_color_hex: '#ffffff',
- }, {
- bg_color_hex: '#f7df1e',
- id: 6,
- name: 'javascript',
- text_color_hex: '#000000',
- }, {
- bg_color_hex: '#f7df1e',
- id: 6,
- name: 'javascript',
- text_color_hex: '#000000',
- }];
- const followedTags = {};
- const handleFollowTag = jest.fn();
- const tree = render( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/app/javascript/src/components/__tests__/OnboardingFollowUsers.test.jsx b/app/javascript/src/components/__tests__/OnboardingFollowUsers.test.jsx
deleted file mode 100644
index ba1d7422f..000000000
--- a/app/javascript/src/components/__tests__/OnboardingFollowUsers.test.jsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { h } from 'preact';
-import render from 'preact-render-to-json';
-import OnboardingFollowUsers from '../OnboardingFollowUsers';
-
-describe(' ', () => {
- it('renders properly when given users', () => {
- const users = [
- {
- id: 1,
- name: 'Ben Halpern',
- profile_image_url: 'ben.jpg',
- },
- {
- id: 2,
- name: 'Krusty the Clown',
- profile_image_url: 'clown.jpg',
- },
- {
- id: 3,
- name: 'dev.to staff',
- profile_image_url: 'dev.jpg',
- },
- ];
- const checkedUsers = [
- {
- id: 1,
- name: 'Ben Halpern',
- profile_image_url: 'ben.jpg',
- },
- {
- id: 2,
- name: 'Krusty the Clown',
- profile_image_url: 'clown.jpg',
- },
- {
- id: 3,
- name: 'dev.to staff',
- profile_image_url: 'dev.jpg',
- },
- ];
- const handleCheckUser = jest.fn();
- const handleCheckAllUsers = jest.fn();
- const tree = render( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/app/javascript/src/components/__tests__/OnboardingSingleTag.test.jsx b/app/javascript/src/components/__tests__/OnboardingSingleTag.test.jsx
deleted file mode 100644
index 7f59821f4..000000000
--- a/app/javascript/src/components/__tests__/OnboardingSingleTag.test.jsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { h } from 'preact';
-import { shallow } from 'preact-render-spy';
-import { render } from 'preact-render-to-json';
-import OnboardingSingleTag from '../OnboardingSingleTag';
-
-describe(' ', () => {
- const followingTag = { following: true };
- const notFollowingTag = { following: false };
-
- describe('when given a following tag', () => {
- it('renders correctly', () => {
- const context = render( );
- expect(context).toMatchSnapshot();
- });
-
- it('responses to clicks', () => {
- const onClick = jest.fn();
- const context = shallow( );
- expect(context.find('a').text()).toEqual('#✓');
- context.find('.onboarding-tag-link-follow').simulate('click');
- expect(onClick).toHaveBeenCalledTimes(1);
- context.render( );
- expect(context.find('a').text()).toEqual('#+');
- });
- });
-
- describe('when given a non-following tag', () => {
- it('renders correctly', () => {
- const context = render( );
- expect(context).toMatchSnapshot();
- });
-
- it('responses to clicks', () => {
- const onClick = jest.fn();
- const context = shallow( );
- expect(context.find('a').text()).toEqual('#+');
- context.find('.onboarding-tag-link-follow').simulate('click');
- expect(onClick).toHaveBeenCalledTimes(1);
- context.render( );
- expect(context.find('a').text()).toEqual('#✓');
- });
- });
-});
diff --git a/app/javascript/src/components/__tests__/OnboardingUsers.test.jsx b/app/javascript/src/components/__tests__/OnboardingUsers.test.jsx
deleted file mode 100644
index dff9690c8..000000000
--- a/app/javascript/src/components/__tests__/OnboardingUsers.test.jsx
+++ /dev/null
@@ -1,67 +0,0 @@
-import { h } from 'preact';
-import { shallow } from 'preact-render-spy';
-import { render } from 'preact-render-to-json';
-import OnboardingUsers from '../OnboardingUsers';
-
-describe(' ', () => {
- const users = [
- {
- id: 1,
- name: 'Ben Halpern',
- profile_image_url: 'ben.jpg',
- },
- {
- id: 2,
- name: 'Krusty the Clown',
- profile_image_url: 'clown.jpg',
- },
- {
- id: 3,
- name: 'dev.to staff',
- profile_image_url: 'dev.jpg',
- },
- ];
- const checkedUsers = [
- {
- id: 1,
- name: 'Ben Halpern',
- profile_image_url: 'ben.jpg',
- },
- {
- id: 2,
- name: 'Krusty the Clown',
- profile_image_url: 'clown.jpg',
- },
- {
- id: 3,
- name: 'dev.to staff',
- profile_image_url: 'dev.jpg',
- },
- ];
- const handleCheckUser = jest.fn();
- const handleCheckAllUsers = jest.fn();
-
- describe('when given users to follow', () => {
- it('renders correctly', () => {
- const context = render( );
- expect(context).toMatchSnapshot();
- });
-
- it('responds to clicking Follow All', () => {
- const context = shallow( );
- expect(context.find('#onboarding-user-follow-all-btn').text()).toEqual('✓');
- context.find('#onboarding-user-follow-all-btn').simulate('click');
- expect(handleCheckAllUsers).toHaveBeenCalledTimes(1);
- });
- });
-});
diff --git a/app/javascript/src/components/__tests__/OnboardingWelcome.test.jsx b/app/javascript/src/components/__tests__/OnboardingWelcome.test.jsx
deleted file mode 100644
index bec908009..000000000
--- a/app/javascript/src/components/__tests__/OnboardingWelcome.test.jsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { h } from 'preact';
-import { render } from 'preact-render-to-json';
-import OnboardingWelcome from '../OnboardingWelcome';
-
-describe(' ', () => {
- it('renders correctly', () => {
- const tree = render( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/app/javascript/src/components/__tests__/OnboardingWelcomeThread.test.jsx b/app/javascript/src/components/__tests__/OnboardingWelcomeThread.test.jsx
deleted file mode 100644
index 56dd3b2a4..000000000
--- a/app/javascript/src/components/__tests__/OnboardingWelcomeThread.test.jsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { h } from 'preact';
-import { render } from 'preact-render-to-json';
-import OnboardingWelcomeThread from '../OnboardingWelcomeThread';
-
-describe(' ', () => {
- it('renders correctly', () => {
- const tree = render( );
- expect(tree).toMatchSnapshot();
- });
-});
diff --git a/app/javascript/src/components/__tests__/__snapshots__/OnboardingFollowTags.test.jsx.snap b/app/javascript/src/components/__tests__/__snapshots__/OnboardingFollowTags.test.jsx.snap
deleted file mode 100644
index 8215a6665..000000000
--- a/app/javascript/src/components/__tests__/__snapshots__/OnboardingFollowTags.test.jsx.snap
+++ /dev/null
@@ -1,86 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders properly when given a tag 1`] = `
-
-`;
diff --git a/app/javascript/src/components/__tests__/__snapshots__/OnboardingFollowUsers.test.jsx.snap b/app/javascript/src/components/__tests__/__snapshots__/OnboardingFollowUsers.test.jsx.snap
deleted file mode 100644
index 8bd5c9143..000000000
--- a/app/javascript/src/components/__tests__/__snapshots__/OnboardingFollowUsers.test.jsx.snap
+++ /dev/null
@@ -1,128 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders properly when given users 1`] = `
-
-
- Here are some suggestions based on your interests
-
-
-
-
-
-
-
-
- Ben Halpern
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
- Krusty the Clown
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
- dev.to staff
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-`;
diff --git a/app/javascript/src/components/__tests__/__snapshots__/OnboardingSingleTag.test.jsx.snap b/app/javascript/src/components/__tests__/__snapshots__/OnboardingSingleTag.test.jsx.snap
deleted file mode 100644
index dc50ff69d..000000000
--- a/app/javascript/src/components/__tests__/__snapshots__/OnboardingSingleTag.test.jsx.snap
+++ /dev/null
@@ -1,53 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` when given a following tag renders correctly 1`] = `
-
-`;
-
-exports[` when given a non-following tag renders correctly 1`] = `
-
-`;
diff --git a/app/javascript/src/components/__tests__/__snapshots__/OnboardingUsers.test.jsx.snap b/app/javascript/src/components/__tests__/__snapshots__/OnboardingUsers.test.jsx.snap
deleted file mode 100644
index 5f9437356..000000000
--- a/app/javascript/src/components/__tests__/__snapshots__/OnboardingUsers.test.jsx.snap
+++ /dev/null
@@ -1,128 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` when given users to follow renders correctly 1`] = `
-
-
- Here are some suggestions based on your interests
-
-
-
-
-
-
-
-
- Ben Halpern
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
- Krusty the Clown
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
- dev.to staff
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-`;
diff --git a/app/javascript/src/components/__tests__/__snapshots__/OnboardingWelcome.test.jsx.snap b/app/javascript/src/components/__tests__/__snapshots__/OnboardingWelcome.test.jsx.snap
deleted file mode 100644
index 7403e9e77..000000000
--- a/app/javascript/src/components/__tests__/__snapshots__/OnboardingWelcome.test.jsx.snap
+++ /dev/null
@@ -1,23 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders correctly 1`] = `
-
-
- Thank you for joining the DEV Community.
-
-
- Keep up with the people and software trends you care about. ❤️
-
-
-
-
- Let's get started!
-
-
-
-
-`;
diff --git a/app/javascript/src/components/__tests__/__snapshots__/OnboardingWelcomeThread.test.jsx.snap b/app/javascript/src/components/__tests__/__snapshots__/OnboardingWelcomeThread.test.jsx.snap
deleted file mode 100644
index 4f6d2f598..000000000
--- a/app/javascript/src/components/__tests__/__snapshots__/OnboardingWelcomeThread.test.jsx.snap
+++ /dev/null
@@ -1,21 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[` renders correctly 1`] = `
-
-
- Software is driven by community.
-
-
- Don't hesitate to find a discussion and jump right in.
-
-
-
- Everyone is welcome!
-
-
-
-`;
diff --git a/app/javascript/src/utils/getUnopenedChannels.jsx b/app/javascript/src/utils/getUnopenedChannels.jsx
index 8d299504d..312da141e 100644
--- a/app/javascript/src/utils/getUnopenedChannels.jsx
+++ b/app/javascript/src/utils/getUnopenedChannels.jsx
@@ -118,7 +118,9 @@ class UnopenedChannelNotice extends Component {
padding: '19px 5px 14px',
}}
>
- New Message from {channels}
+ New Message from
+ {' '}
+ {channels}
);
}
diff --git a/app/javascript/src/utils/pusher.js b/app/javascript/src/utils/pusher.js
index aae325a27..4f905ed26 100644
--- a/app/javascript/src/utils/pusher.js
+++ b/app/javascript/src/utils/pusher.js
@@ -26,10 +26,10 @@ export default function setupPusher(key, callbackObjects) {
'client-initiatevideocall',
callbackObjects.videoCallInitiated,
);
- channel.bind('client-endvideocall', callbackObjects.videoCallEnded);
- // channel.bind('pusher:subscription_succeeded', callbackObjects.channelSubscribed);
+ channel.bind('client-endvideocall', callbackObjects.videoCallEnded);
channel.bind('pusher:subscription_error', callbackObjects.channelError);
+
return channel;
});
}