Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[examples] Fix scully test #3572

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"repoId": "46af5832-8fee-459b-b18b-8bba203a5b1f",
"lastSync": 0
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Scully

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.21.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli).

## Development server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"aot": true,
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"scripts": []
Expand All @@ -36,7 +36,6 @@
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
Expand Down Expand Up @@ -110,5 +109,8 @@
}
}
},
"defaultProject": "scully"
"defaultProject": "scully",
"cli": {
"analytics": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: First post
description: blog description
publish: false
---

# First post
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Second post
description: blog description
publish: false
---

# Second post
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function(config) {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/scully'),
dir: require('path').join(__dirname, './coverage/scully-blog'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
},
Expand Down
59 changes: 29 additions & 30 deletions packages/now-static-build/test/fixtures/49-scully/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,47 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build": "ng build && scully",
"test": "ng test",
"lint": "ng lint",
"scully": "scully",
"scully:serve": "scully serve"
"scully": "scully"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/forms": "~8.2.14",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"@angular/animations": "~9.0.0-rc.7",
"@angular/common": "~9.0.0-rc.7",
"@angular/compiler": "~9.0.0-rc.7",
"@angular/core": "~9.0.0-rc.7",
"@angular/forms": "~9.0.0-rc.7",
"@angular/platform-browser": "~9.0.0-rc.7",
"@angular/platform-browser-dynamic": "~9.0.0-rc.7",
"@angular/router": "~9.0.0-rc.7",
"@scullyio/init": "0.0.9",
"@scullyio/ng-lib": "latest",
"@scullyio/scully": "latest",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
"rxjs": "6.5.3",
"tslib": "1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.21",
"@angular/cli": "~8.3.21",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@angular-devkit/build-angular": "~0.900.0-rc.7",
"@angular/cli": "~9.0.0-rc.7",
"@angular/compiler-cli": "~9.0.0-rc.7",
"@angular/language-service": "~9.0.0-rc.7",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma": "~4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.2",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.6.4"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
exports.config = {
projectRoot: './src/app',
routes: {},
routes: {
'/blog/:slug': {
type: 'contentFolder',
slug: {
folder: './blog',
},
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
{
path: 'blog',
loadChildren: () => import('./blog/blog.module').then(m => m.BlogModule),
},
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<div>
Scully on ZEIT Now.
</div>
<ul>
<li *ngFor="let post of posts$ | async">
<a [routerLink]="post.route">{{ post.title }}</a>
</li>
</ul>

<hr />

<router-outlet></router-outlet>
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent],
}).compileComponents();
}));

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'scully'`, () => {
it(`should have as title 'scully-blog'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('scully');
const app = fixture.componentInstance;
expect(app.title).toEqual('scully-blog');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain(
'scully app is running!'
'scully-blog app is running!'
);
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import { IdleMonitorService } from '@scullyio/ng-lib';
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { ScullyRoute, ScullyRoutesService } from '@scullyio/ng-lib';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
constructor() {}
title = 'scully';
export class AppComponent implements OnInit {
posts$: Observable<ScullyRoute[]>;

constructor(private srs: ScullyRoutesService) {}

ngOnInit() {
this.posts$ = this.srs.available$.pipe(
map(routeList => {
return routeList.filter((route: ScullyRoute) =>
route.route.startsWith(`/blog/`)
);
})
);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, HttpClientModule],
imports: [BrowserModule, AppRoutingModule, HttpClientModule],
providers: [],
bootstrap: [AppComponent],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { BlogComponent } from './blog.component';

const routes: Routes = [
{
path: ':slug',
component: BlogComponent,
},
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class BlogRoutingModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


::slotted(h1) {
color:rgb(51, 6, 37);
background-color: rgb(248, 211, 236);
padding: 5px;
border-radius: 5px;
width: fit-content;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h3>ScullyIo content</h3>
<hr>

<!-- This is where Scully will inject the static HTML -->
<scully-content></scully-content>
<hr>
<h4>End of content</h4>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { BlogComponent } from './Blog.component';

describe('BlogComponent', () => {
let component: BlogComponent;
let fixture: ComponentFixture<BlogComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [BlogComponent],
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(BlogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Router, ROUTES } from '@angular/router';

declare var ng: any;

@Component({
selector: 'app-blog',
templateUrl: './blog.component.html',
styleUrls: ['./blog.component.css'],
preserveWhitespaces: true,
encapsulation: ViewEncapsulation.Emulated,
})
export class BlogComponent implements OnInit {
ngOnInit() {}

constructor(private router: Router, private route: ActivatedRoute) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ComponentsModule } from '@scullyio/ng-lib';
import { BlogRoutingModule } from './blog-routing.module';
import { BlogComponent } from './blog.component';

@NgModule({
declarations: [BlogComponent],
imports: [CommonModule, BlogRoutingModule, ComponentsModule],
})
export class BlogModule {}
Empty file.
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
[]
[
{
"route": "/blog/first-post",
"title": "First post",
"description": "blog description",
"publish": false
},
{
"route": "/blog/second-post",
"title": "Second post",
"description": "blog description",
"publish": false
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Scully</title>
<title>Scully on ZEIT Now</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
Expand Down