Skip to content

Commit

Permalink
Merge a2308b3 into 24bf153
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathew1011 committed Apr 20, 2020
2 parents 24bf153 + a2308b3 commit 41c6144
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 14 deletions.
6 changes: 3 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumWarning": "5mb",
"maximumError": "8mb"
},
{
"type": "anyComponentStyle",
Expand Down Expand Up @@ -171,4 +171,4 @@
}
},
"defaultProject": "weaver-components"
}
}
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<title>Weaver Comonents</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="src/favicon.ico">
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
<style>
[wvr-hide-content] {
display: none;
Expand Down Expand Up @@ -57,7 +57,7 @@
</wvr-nav-list>
</wvr-footer>

<script defer src="dist/bundle/0x/weaver-components.js"></script>
<script defer src="weaver-components.js"></script>
</body>

</html>
</html>
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prebuild": "npm run build:wvr-elements",
"postbuild": "npm run build:wvr-components",
"start": "ng serve --port 4200",
"start:static": "static-server -p 9080",
"start:static": "node scripts/serve-static.js",
"test": "npm run test:unit && npm run test:e2e",
"test:e2e": "ng e2e",
"test:unit": "ng test --no-watch",
Expand Down Expand Up @@ -83,11 +83,12 @@
"ng-packagr": "^9.0.0",
"protractor": "^5.4.3",
"rimraf": "^3.0.2",
"static-server": "^2.2.1",
"ts-loader": "^6.2.1",
"ts-node": "~8.6.2",
"tsickle": "^0.38.0",
"tslint": "~6.0.0",
"tslint-angular": "^3.0.2",
"typescript": "^3.7.5"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,17 @@ describe('WvrFooterComponent', () => {
.toBeFalse();
});

it('should positionSelf when window is resized', () => {
const spyOnResize = spyOn(component, 'positionSelf');
window.dispatchEvent(new Event('resize'));
expect(spyOnResize).toHaveBeenCalled();
});

it('should have isSticky feature to true', () => {
expect(component.isSticky).toBeFalse();
window.resizeBy(300, 300);
window.dispatchEvent(new Event('resize'));
expect(component.isSticky).toBeTruthy();
});

});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, HostBinding, Input } from '@angular/core';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { DomSanitizer } from '@angular/platform-browser';

/**
* Intended to appear at the top of document and provides for branding, links and page title.
Expand All @@ -18,7 +18,7 @@ export class WvrHeaderComponent {
@Input() headerTitle = 'Weaver Header Component';

/** A resolvable URI to an image to be displayed as the logo. */
@Input() logoSrc: SafeUrl = this.domSanitizer.bypassSecurityTrustUrl('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAzODMgMzgzIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiIHhtbG5zOnNlcmlmPSJodHRwOi8vd3d3LnNlcmlmLmNvbS8iIHN0eWxlPSJmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLW1pdGVybGltaXQ6MjsiPjxnPjxwYXRoIGQ9Ik0zODIuMzY2LDk1LjU5MmMwLC01Mi43NTkgLTQyLjgzMywtOTUuNTkyIC05NS41OTEsLTk1LjU5MmwtMTkxLjE4MywwYy01Mi43NTksMCAtOTUuNTkyLDQyLjgzMyAtOTUuNTkyLDk1LjU5MmwwLDE5MS4xODNjMCw1Mi43NTggNDIuODMzLDk1LjU5MSA5NS41OTIsOTUuNTkxbDE5MS4xODMsMGM1Mi43NTgsMCA5NS41OTEsLTQyLjgzMyA5NS41OTEsLTk1LjU5MWwwLC0xOTEuMTgzWiIgc3R5bGU9ImZpbGw6IzUwMDAwMDsiLz48dGV4dCB4PSIzMS40ODdweCIgeT0iMzAyLjA2M3B4IiBzdHlsZT0iZm9udC1mYW1pbHk6J0hpcmFLYWt1U3RkTi1XOCcsICdIaXJhZ2lubyBLYWt1IEdvdGhpYyBTdGROJywgc2Fucy1zZXJpZjtmb250LXdlaWdodDo4MDA7Zm9udC1zaXplOjI4OHB4O2ZpbGw6I2ZmZjsiPlc8L3RleHQ+PC9nPjwvc3ZnPg==');
@Input() logoSrc = 'assets/weaver-w.svg';

/** A resolvable URL to a location linkable from the logo. */
@Input() logoHref = '#logo';
Expand Down
10 changes: 8 additions & 2 deletions scripts/build-wvr-components.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const fs = require('fs-extra');
const concat = require('concat');

const package = require('../package.json');

const majorVersion = package.version.split('.')[0];
const dirName = `${majorVersion}x`;
const assetPath = 'dist/weaver-components';
const basePath = 'dist/bundle';
const dirName = `${majorVersion}x`;
const dirPath = `${basePath}/${dirName}`;
const latestPath = `${basePath}/latest`;

Expand All @@ -25,4 +26,9 @@ const latestPath = `${basePath}/latest`;
fs.copy(`${dirPath}/weaver-components.js`, `${latestPath}/weaver-components.js`);
fs.copy(`${dirPath}/weaver-components.js`, "dist/docs/usage/weaver-components.js");
fs.copy('dist/weaver-components/assets', "dist/docs/usage/assets");

// to ensure static assets present in latest and <latest>x folders
fs.ensureDir(assetPath);
fs.copy(`${assetPath}/assets`, `${dirPath}/assets`);
fs.copy(`${assetPath}/assets`, `${latestPath}/assets`);
})();
35 changes: 35 additions & 0 deletions scripts/serve-static.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const fs = require('fs');
const process = require('process');
const StaticServer = require('static-server');

const fsPromises = fs.promises;
const basePath = 'dist/bundle';
const latestPath = `${basePath}/latest`;

const server = new StaticServer({
rootPath: 'dist/bundle/latest',
port: 8080,
name: 'tl-component-static-server',
followSymlink: true,
});

server.start(function () {
console.log('Server listening to', server.port);
fsPromises.copyFile('index.html', `${latestPath}/index.html`);
});

process.on('exit', function () {
fs.unlink(`${latestPath}/index.html`, err => {
if (err) throw err;
});
console.log('Cleaning up');
});

process.on('SIGINT', function () {
process.exit();
});

process.on('uncaughtException', function (e) {
console.log(e.stack);
process.exit(99);
});
Binary file added src/assets/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<title>Weaver Comonents</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
<style>
[wvr-hide-content] {
display: none;
Expand Down Expand Up @@ -54,4 +54,4 @@
</wvr-footer>
</body>

</html>
</html>

0 comments on commit 41c6144

Please sign in to comment.