Skip to content

Commit 18036ff

Browse files
committed
fix(tests): fixed tests, change renderer to renderer2
1 parent ed464c8 commit 18036ff

16 files changed

+113
-95
lines changed

demo/src/app/common/main-menu/main-menu.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { StyleManager } from '../../theme/style-manager';
66
import { ThemeStorage } from '../../theme/theme-storage';
77

88
const _bs3Css =
9-
'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css';
9+
'/assets/css/bootstrap.min.css';
1010
const _bs4Css =
1111
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css';
1212

demo/src/assets/css/bootstrap.min.css

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<!--link to bootstrap.css-->
1919
<!--<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet">-->
20-
<link rel="stylesheet" class="style-manager-theme" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
20+
<link rel="stylesheet" class="style-manager-theme" href="/assets/css/bootstrap.min.css">
2121
<!--<link rel="stylesheet" href="assets/css/style.css">-->
2222
<!--<link rel="stylesheet" href="assets/css/prettify-angulario.css">-->
2323

demo/src/ng-api-doc.ts

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ export const ngdoc: any = {
11901190
},
11911191
{
11921192
"name": "setEventHandlers",
1193-
"description": "<p>event handlers</p>\n",
1193+
"description": "<p>event handlers </p>\n",
11941194
"args": [
11951195
{
11961196
"name": "container",
@@ -1623,6 +1623,25 @@ export const ngdoc: any = {
16231623
"methods": [],
16241624
"properties": []
16251625
},
1626+
"BsModalRef": {
1627+
"fileName": "src/modal/bs-modal-ref.service.ts",
1628+
"className": "BsModalRef",
1629+
"description": "",
1630+
"methods": [],
1631+
"properties": [
1632+
{
1633+
"name": "content",
1634+
"type": "any",
1635+
"description": "<p>Reference to a component inside the modal. Null if modal&#39;s been created with TemplateRef</p>\n"
1636+
},
1637+
{
1638+
"name": "hide",
1639+
"defaultValue": "Function",
1640+
"type": "() => void",
1641+
"description": "<p>Hides the modal</p>\n"
1642+
}
1643+
]
1644+
},
16261645
"BsModalService": {
16271646
"fileName": "src/modal/bs-modal.service.ts",
16281647
"className": "BsModalService",
@@ -1645,7 +1664,7 @@ export const ngdoc: any = {
16451664
},
16461665
{
16471666
"name": "checkScrollbar",
1648-
"description": "<p>AFTER PR MERGE MODAL.COMPONENT WILL BE USING THIS CODE\nScroll bar tricks </p>\n",
1667+
"description": "<p>AFTER PR MERGE MODAL.COMPONENT WILL BE USING THIS CODE \nScroll bar tricks </p>\n",
16491668
"args": [],
16501669
"returnType": "void"
16511670
}
@@ -1686,7 +1705,7 @@ export const ngdoc: any = {
16861705
{
16871706
"name": "backdrop",
16881707
"type": "boolean | \"static\"",
1689-
"description": "<p>Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn&#39;t close the modal on click.</p>\n"
1708+
"description": "<p>Includes a modal-backdrop element. Alternatively,\nspecify static for a backdrop which doesn&#39;t close the modal on click.</p>\n"
16901709
},
16911710
{
16921711
"name": "class",
@@ -1710,26 +1729,6 @@ export const ngdoc: any = {
17101729
}
17111730
]
17121731
},
1713-
"BsModalRef": {
1714-
"fileName": "src/modal/modal-options.class.ts",
1715-
"className": "BsModalRef",
1716-
"description": "",
1717-
"methods": [
1718-
{
1719-
"name": "hide",
1720-
"description": "<p>Hides the modal</p>\n",
1721-
"args": [],
1722-
"returnType": "void"
1723-
}
1724-
],
1725-
"properties": [
1726-
{
1727-
"name": "content",
1728-
"type": "any",
1729-
"description": "<p>Reference to a component inside the modal. Null if modal&#39;s been created with TemplateRef</p>\n"
1730-
}
1731-
]
1732-
},
17331732
"ModalDirective": {
17341733
"fileName": "src/modal/modal.directive.ts",
17351734
"className": "ModalDirective",
@@ -1896,7 +1895,7 @@ export const ngdoc: any = {
18961895
},
18971896
{
18981897
"name": "pageChanged",
1899-
"description": "<p>fired when page was changed, $event:{page, itemsPerPage} equals to object with current page index and number of items per page </p>\n"
1898+
"description": "<p>fired when page was changed, $event:{page, itemsPerPage} equals to\nobject with current page index and number of items per page</p>\n"
19001899
}
19011900
],
19021901
"properties": [],
@@ -2167,7 +2166,7 @@ export const ngdoc: any = {
21672166
{
21682167
"name": "targetAttachment",
21692168
"type": "string",
2170-
"description": "<p>A string similar to <code>attachment</code>. The one difference is that, if it&#39;s not provided, <code>targetAttachment</code> will assume the mirror image of <code>attachment</code>. </p>\n"
2169+
"description": "<p>A string similar to <code>attachment</code>. The one difference is that, if it&#39;s not provided,\n<code>targetAttachment</code> will assume the mirror image of <code>attachment</code>.</p>\n"
21712170
},
21722171
{
21732172
"name": "targetOffset",

demo/src/ngsw-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"external": {
1111
"urls": [
1212
{
13-
"url": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
13+
"url": "/assets/css/bootstrap.min.css"
1414
},
1515
{
1616
"url": "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"

scripts/bs-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
module.exports = {
22
port: 4200,
33
server: {
4-
// baseDir: './gh-pages',
5-
baseDir: './demo/dist',
4+
baseDir: './gh-pages',
65
middleware : { 1 : require('compression')()}
76
}
87
};

src/dropdown/bs-dropdown-container.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Component,
55
ElementRef,
66
OnDestroy,
7-
Renderer
7+
Renderer2
88
} from '@angular/core';
99
import { BsDropdownState } from './bs-dropdown.state';
1010

@@ -33,21 +33,21 @@ export class BsDropdownContainerComponent implements OnDestroy {
3333
constructor(
3434
private _state: BsDropdownState,
3535
private cd: ChangeDetectorRef,
36-
private _renderer: Renderer,
36+
private _renderer: Renderer2,
3737
_element: ElementRef
3838
) {
3939
this._subscription = _state.isOpenChange.subscribe((value: boolean) => {
4040
this.isOpen = value;
4141
const dropdown = _element.nativeElement.querySelector('.dropdown-menu');
4242
if (dropdown) {
43-
this._renderer.setElementClass(dropdown, 'show', true);
43+
this._renderer.addClass(dropdown, 'show');
4444
if (dropdown.classList.contains('dropdown-menu-right')) {
45-
this._renderer.setElementStyle(dropdown, 'left', 'auto');
46-
this._renderer.setElementStyle(dropdown, 'right', '0');
45+
this._renderer.setStyle(dropdown, 'left', 'auto');
46+
this._renderer.setStyle(dropdown, 'right', '0');
4747
}
4848
if (this.direction === 'up') {
49-
this._renderer.setElementStyle(dropdown, 'top', 'auto');
50-
this._renderer.setElementStyle(
49+
this._renderer.setStyle(dropdown, 'top', 'auto');
50+
this._renderer.setStyle(
5151
dropdown,
5252
'transform',
5353
'translateY(-101%)'

src/modal/bs-modal.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
ComponentRef,
33
Injectable,
44
TemplateRef,
5-
EventEmitter, Renderer2
5+
EventEmitter, Renderer2, RendererFactory2
66
} from '@angular/core';
77

88
import { ComponentLoader } from '../component-loader/component-loader.class';

src/modal/modal-backdrop.component.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ElementRef, OnInit, Renderer } from '@angular/core';
1+
import { Component, ElementRef, OnInit, Renderer2 } from '@angular/core';
22

33
import { CLASS_NAME } from './modal-options.class';
44
import { isBs3 } from '../utils/theme-provider';
@@ -27,37 +27,48 @@ export class ModalBackdropComponent implements OnInit {
2727

2828
set isShown(value: boolean) {
2929
this._isShown = value;
30-
this.renderer.setElementClass(
31-
this.element.nativeElement,
32-
`${CLASS_NAME.IN}`,
33-
value
34-
);
35-
if (!isBs3()) {
36-
this.renderer.setElementClass(
30+
if (value) {
31+
this.renderer.addClass(
32+
this.element.nativeElement,
33+
`${CLASS_NAME.IN}`
34+
);
35+
} else {
36+
this.renderer.removeClass(
3737
this.element.nativeElement,
38-
`${CLASS_NAME.SHOW}`,
39-
value
38+
`${CLASS_NAME.IN}`
4039
);
4140
}
41+
if (!isBs3()) {
42+
if (value) {
43+
this.renderer.addClass(
44+
this.element.nativeElement,
45+
`${CLASS_NAME.SHOW}`
46+
);
47+
} else {
48+
this.renderer.removeClass(
49+
this.element.nativeElement,
50+
`${CLASS_NAME.SHOW}`
51+
);
52+
}
53+
}
4254
}
4355

4456
element: ElementRef;
45-
renderer: Renderer;
57+
renderer: Renderer2;
4658

4759
protected _isAnimated: boolean;
4860
protected _isShown = false;
4961

50-
constructor(element: ElementRef, renderer: Renderer) {
62+
constructor(element: ElementRef, renderer: Renderer2) {
5163
this.element = element;
5264
this.renderer = renderer;
5365
}
5466

5567
ngOnInit(): void {
5668
if (this.isAnimated) {
57-
this.renderer.setElementClass(
69+
this.renderer.addClass(
5870
this.element.nativeElement,
59-
`${CLASS_NAME.FADE}`,
60-
this.isAnimated
71+
`${CLASS_NAME.FADE}`
6172
);
6273
Utils.reflow(this.element.nativeElement);
6374
}

src/modal/modal-container.component.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
HostListener,
55
OnDestroy,
66
OnInit,
7-
Renderer
7+
Renderer2
88
} from '@angular/core';
99
import {
1010
CLASS_NAME,
@@ -40,37 +40,35 @@ export class ModalContainerComponent implements OnInit, OnDestroy {
4040
constructor(options: ModalOptions,
4141
protected _element: ElementRef,
4242
private bsModalService: BsModalService,
43-
private _renderer: Renderer) {
43+
private _renderer: Renderer2) {
4444
this.config = Object.assign({}, options);
4545
}
4646

4747
ngOnInit(): void {
4848
if (this.isAnimated) {
49-
this._renderer.setElementClass(
49+
this._renderer.addClass(
5050
this._element.nativeElement,
51-
CLASS_NAME.FADE,
52-
true
51+
CLASS_NAME.FADE
5352
);
5453
}
55-
this._renderer.setElementStyle(
54+
this._renderer.setStyle(
5655
this._element.nativeElement,
5756
'display',
5857
'block'
5958
);
6059
setTimeout(() => {
6160
this.isShown = true;
62-
this._renderer.setElementClass(
61+
this._renderer.addClass(
6362
this._element.nativeElement,
64-
isBs3() ? CLASS_NAME.IN : CLASS_NAME.SHOW,
65-
true
63+
isBs3() ? CLASS_NAME.IN : CLASS_NAME.SHOW
6664
);
6765
}, this.isAnimated ? TRANSITION_DURATIONS.BACKDROP : 0);
6866
if (document && document.body) {
6967
if (this.bsModalService.getModalsCount() === 1) {
7068
this.bsModalService.checkScrollbar();
7169
this.bsModalService.setScrollbar();
7270
}
73-
this._renderer.setElementClass(document.body, CLASS_NAME.OPEN, true);
71+
this._renderer.addClass(document.body, CLASS_NAME.OPEN);
7472
}
7573
}
7674

@@ -109,10 +107,9 @@ export class ModalContainerComponent implements OnInit, OnDestroy {
109107
return;
110108
}
111109
this.isModalHiding = true;
112-
this._renderer.setElementClass(
110+
this._renderer.removeClass(
113111
this._element.nativeElement,
114-
isBs3() ? CLASS_NAME.IN : CLASS_NAME.SHOW,
115-
false
112+
isBs3() ? CLASS_NAME.IN : CLASS_NAME.SHOW
116113
);
117114
setTimeout(() => {
118115
this.isShown = false;
@@ -121,7 +118,7 @@ export class ModalContainerComponent implements OnInit, OnDestroy {
121118
document.body &&
122119
this.bsModalService.getModalsCount() === 1
123120
) {
124-
this._renderer.setElementClass(document.body, CLASS_NAME.OPEN, false);
121+
this._renderer.removeClass(document.body, CLASS_NAME.OPEN);
125122
}
126123
this.bsModalService.hide(this.level);
127124
this.isModalHiding = false;

src/pagination/pager.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
Component,
33
ElementRef,
44
OnInit,
5-
Renderer,
5+
Renderer2,
66
Input,
77
Output,
88
EventEmitter,
@@ -115,7 +115,7 @@ export class PagerComponent implements ControlValueAccessor, OnInit {
115115
onChange: any = Function.prototype;
116116
onTouched: any = Function.prototype;
117117

118-
renderer: Renderer;
118+
renderer: Renderer2;
119119
elementRef: ElementRef;
120120

121121
classMap: string;
@@ -127,7 +127,7 @@ export class PagerComponent implements ControlValueAccessor, OnInit {
127127
protected inited = false;
128128
protected _page = 1;
129129

130-
constructor(renderer: Renderer,
130+
constructor(renderer: Renderer2,
131131
elementRef: ElementRef,
132132
paginationConfig: PaginationConfig) {
133133
this.renderer = renderer;

src/pagination/pagination.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Input,
66
OnInit,
77
Output,
8-
Renderer,
8+
Renderer2,
99
forwardRef
1010
} from '@angular/core';
1111
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@@ -119,7 +119,7 @@ export class PaginationComponent implements ControlValueAccessor, OnInit {
119119

120120
onChange: any = Function.prototype;
121121
onTouched: any = Function.prototype;
122-
renderer: Renderer;
122+
renderer: Renderer2;
123123
elementRef: ElementRef;
124124
classMap: string;
125125
pages: any[];
@@ -131,7 +131,7 @@ export class PaginationComponent implements ControlValueAccessor, OnInit {
131131
protected _page = 1;
132132

133133
constructor(
134-
renderer: Renderer,
134+
renderer: Renderer2,
135135
elementRef: ElementRef,
136136
paginationConfig: PaginationConfig
137137
) {

0 commit comments

Comments
 (0)