1
0
mirror of https://github.com/NicolasConstant/sengi synced 2025-01-31 10:44:55 +01:00

Merge pull request #20 from NicolasConstant/develop

Develop
This commit is contained in:
Nicolas Constant 2018-10-29 03:28:54 -04:00 committed by GitHub
commit c7e9084307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 264 additions and 172 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@
/dist-server
/tmp
/out-tsc
TESTS-Chrome*.xml
# dependencies
/node_modules

View File

@ -1,138 +1,144 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"sengi": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/sass/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": [
"./src/sass",
"./node_modules/bootstrap/scss"
]
},
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"sengi": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/sass/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": [
"./src/sass",
"./node_modules/bootstrap/scss"
]
},
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sengi:build"
},
"configurations": {
"production": {
"browserTarget": "sengi:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sengi:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/sass/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
],
"stylePreprocessorOptions": {
"includePaths": [
"./src/sass",
"./node_modules/bootstrap/scss"
]
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sengi:build"
},
"configurations": {
"production": {
"browserTarget": "sengi:build:production"
"sengi-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "sengi:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sengi:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.css"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"sengi-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "sengi:serve"
}
"defaultProject": "sengi",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
},
"defaultProject": "sengi",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}

View File

@ -9,8 +9,9 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-junit-reporter')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
@ -20,12 +21,24 @@ module.exports = function (config) {
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
reporters: ['progress', 'kjhtml', 'junit'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
singleRun: false,
// the default configuration
junitReporter: {
outputDir: '', // results will be saved as $outputDir/$browserName.xml
outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile
suite: '', // suite will become the package name attribute in xml testsuite element
useBrowserName: true, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
properties: {}, // key value pair of properties to add to the <properties> section of the report
xmlVersion: null // use '1' if reporting to be per SonarQube 6.2 XML format
}
});
};

18
package-lock.json generated
View File

@ -6350,6 +6350,24 @@
"karma-jasmine": "^1.0.2"
}
},
"karma-junit-reporter": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/karma-junit-reporter/-/karma-junit-reporter-1.2.0.tgz",
"integrity": "sha1-T5xAzt+xo5X4rvh2q/lhiZF8Y5Y=",
"dev": true,
"requires": {
"path-is-absolute": "^1.0.0",
"xmlbuilder": "8.2.2"
},
"dependencies": {
"xmlbuilder": {
"version": "8.2.2",
"resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz",
"integrity": "sha1-aSSGc0ELS6QuGmE2VR0pIjNap3M=",
"dev": true
}
}
},
"karma-source-map-support": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.3.0.tgz",

View File

@ -9,6 +9,7 @@
"serve": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"test-nowatch": "ng test --watch=false",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "ng build && electron .",
@ -51,6 +52,7 @@
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-junit-reporter": "^1.2.0",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",

View File

@ -1,6 +1,6 @@
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
xdescribe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AddNewAccountComponent } from './add-new-account.component';
describe('AddNewAccountComponent', () => {
xdescribe('AddNewAccountComponent', () => {
let component: AddNewAccountComponent;
let fixture: ComponentFixture<AddNewAccountComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AddNewAccountComponent } from '../add-new-account/add-new-account.component';
describe('AddNewAccountComponent', () => {
xdescribe('AddNewAccountComponent', () => {
let component: AddNewAccountComponent;
let fixture: ComponentFixture<AddNewAccountComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FloatingColumnComponent } from './floating-column.component';
describe('FloatingColumnComponent', () => {
xdescribe('FloatingColumnComponent', () => {
let component: FloatingColumnComponent;
let fixture: ComponentFixture<FloatingColumnComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ManageAccountComponent } from './manage-account.component';
describe('ManageAccountComponent', () => {
xdescribe('ManageAccountComponent', () => {
let component: ManageAccountComponent;
let fixture: ComponentFixture<ManageAccountComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchComponent } from './search.component';
describe('SearchComponent', () => {
xdescribe('SearchComponent', () => {
let component: SearchComponent;
let fixture: ComponentFixture<SearchComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingsComponent } from './settings.component';
describe('SettingsComponent', () => {
xdescribe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AccountIconComponent } from './account-icon.component';
describe('AccountIconComponent', () => {
xdescribe('AccountIconComponent', () => {
let component: AccountIconComponent;
let fixture: ComponentFixture<AccountIconComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LeftSideBarComponent } from './left-side-bar.component';
describe('LeftSideBarComponent', () => {
xdescribe('LeftSideBarComponent', () => {
let component: LeftSideBarComponent;
let fixture: ComponentFixture<LeftSideBarComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HashtagComponent } from './hashtag.component';
describe('HashtagComponent', () => {
xdescribe('HashtagComponent', () => {
let component: HashtagComponent;
let fixture: ComponentFixture<HashtagComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ActionBarComponent } from './action-bar.component';
describe('ActionBarComponent', () => {
xdescribe('ActionBarComponent', () => {
let component: ActionBarComponent;
let fixture: ComponentFixture<ActionBarComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AttachementsComponent } from './attachements.component';
describe('AttachementsComponent', () => {
xdescribe('AttachementsComponent', () => {
let component: AttachementsComponent;
let fixture: ComponentFixture<AttachementsComponent>;

View File

@ -1,25 +1,78 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DatabindedTextComponent } from './databinded-text.component';
import { By } from '@angular/platform-browser';
describe('DatabindedTextComponent', () => {
let component: DatabindedTextComponent;
let fixture: ComponentFixture<DatabindedTextComponent>;
let component: DatabindedTextComponent;
let fixture: ComponentFixture<DatabindedTextComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DatabindedTextComponent ]
})
.compileComponents();
}));
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DatabindedTextComponent]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DatabindedTextComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
beforeEach(() => {
fixture = TestBed.createComponent(DatabindedTextComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should parse text', () => {
const sample = '<p>sample text<p>';
component.text = sample;
// fixture.detectChanges();
expect(component.processedText).toContain(sample);
});
it('should parse hashtag', () => {
const hashtag = 'programmers';
const url = 'https://test.social/tags/programmers';
const sample = `<p>bla1 <a href="${url}" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>${hashtag}</span></a> bla2</p>`;
component.text = sample;
expect(component.processedText).toContain('<a href class="programmers">#programmers</a>');
expect(component.processedText).toContain('bla1');
expect(component.processedText).toContain('bla2');
});
it('should parse mention', () => {
const mention = 'sengi_app';
const url = 'https://mastodon.social/@sengi_app';
const sample = `<p>bla1 <span class="h-card"><a href="${url}" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>${mention}</span></a></span> bla2</p>`;
component.text = sample;
expect(component.processedText).toContain('<a href class="account--sengi_app-mastodon-social" title="@sengi_app@mastodon.social">@sengi_app</a>');
expect(component.processedText).toContain('bla1');
expect(component.processedText).toContain('bla2');
});
it('should parse link', () => {
const url = 'mydomain.co/test';
const sample = `<p>bla1 <a href="https://${url}" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="">${url}</span><span class="invisible"></span></a> bla2</p>`;
component.text = sample;
expect(component.processedText).toContain('<a href class="link-httpsmydomaincotest" title="open link">mydomain.co/test</a>');
expect(component.processedText).toContain('bla1');
expect(component.processedText).toContain('bla2');
});
it('should parse combined hashtag, mention and link', () => {
const hashtag = 'programmers';
const hashtagUrl = 'https://test.social/tags/programmers';
const mention = 'sengi_app';
const mentionUrl = 'https://mastodon.social/@sengi_app';
const linkUrl = 'mydomain.co/test';
const sample = `<p>bla1 <a href="${hashtagUrl}" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>${hashtag}</span></a> bla2 <span class="h-card"><a href="${mentionUrl}" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>${mention}</span></a></span> bla3 <a href="https://${linkUrl}" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="">${linkUrl}</span><span class="invisible"></span></a> bla4</p>`;
component.text = sample;
expect(component.processedText).toContain('<a href class="programmers">#programmers</a>');
expect(component.processedText).toContain('<a href class="account--sengi_app-mastodon-social" title="@sengi_app@mastodon.social">@sengi_app</a>');
expect(component.processedText).toContain('<a href class="link-httpsmydomaincotest" title="open link">mydomain.co/test</a>');
expect(component.processedText).toContain('bla1');
expect(component.processedText).toContain('bla2');
expect(component.processedText).toContain('bla3');
expect(component.processedText).toContain('bla4');
});
});

View File

@ -1,5 +1,4 @@
import { Component, OnInit, Input, EventEmitter, Output, Renderer2, ViewChild, ElementRef } from '@angular/core';
import { forEach } from '@angular/router/src/utils/collection';
@Component({
selector: 'app-databinded-text',

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReplyToStatusComponent } from './reply-to-status.component';
describe('ReplyToStatusComponent', () => {
xdescribe('ReplyToStatusComponent', () => {
let component: ReplyToStatusComponent;
let fixture: ComponentFixture<ReplyToStatusComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StatusComponent } from './status.component';
describe('StatusComponent', () => {
xdescribe('StatusComponent', () => {
let component: StatusComponent;
let fixture: ComponentFixture<StatusComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StreamOverlayComponent } from './stream-overlay.component';
describe('StreamOverlayComponent', () => {
xdescribe('StreamOverlayComponent', () => {
let component: StreamOverlayComponent;
let fixture: ComponentFixture<StreamOverlayComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StreamComponent } from './stream.component';
describe('StreamComponent', () => {
xdescribe('StreamComponent', () => {
let component: StreamComponent;
let fixture: ComponentFixture<StreamComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ThreadComponent } from './thread.component';
describe('ThreadComponent', () => {
xdescribe('ThreadComponent', () => {
let component: ThreadComponent;
let fixture: ComponentFixture<ThreadComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserProfileComponent } from './user-profile.component';
describe('UserProfileComponent', () => {
xdescribe('UserProfileComponent', () => {
let component: UserProfileComponent;
let fixture: ComponentFixture<UserProfileComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StreamsSelectionFooterComponent } from './streams-selection-footer.component';
describe('StreamsSelectionFooterComponent', () => {
xdescribe('StreamsSelectionFooterComponent', () => {
let component: StreamsSelectionFooterComponent;
let fixture: ComponentFixture<StreamsSelectionFooterComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WaitingAnimationComponent } from './waiting-animation.component';
describe('WaitingAnimationComponent', () => {
xdescribe('WaitingAnimationComponent', () => {
let component: WaitingAnimationComponent;
let fixture: ComponentFixture<WaitingAnimationComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RegisterNewAccountComponent } from './register-new-account.component';
describe('RegisterNewAccountComponent', () => {
xdescribe('RegisterNewAccountComponent', () => {
let component: RegisterNewAccountComponent;
let fixture: ComponentFixture<RegisterNewAccountComponent>;

View File

@ -2,7 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StreamsMainDisplayComponent } from './streams-main-display.component';
describe('StreamsMainDisplayComponent', () => {
xdescribe('StreamsMainDisplayComponent', () => {
let component: StreamsMainDisplayComponent;
let fixture: ComponentFixture<StreamsMainDisplayComponent>;

View File

@ -2,7 +2,7 @@ import { TestBed, inject } from '@angular/core/testing';
import { MastodonService } from './mastodon.service';
describe('MastodonService', () => {
xdescribe('MastodonService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [MastodonService]

View File

@ -2,7 +2,7 @@ import { TestBed, inject } from '@angular/core/testing';
import { NavigationService } from './navigation.service';
describe('NavigationService', () => {
xdescribe('NavigationService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [NavigationService]