ngx-slimscroll
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -31,4 +31,4 @@ // Karma configuration file, see link for more information | ||
browsers: ['Chrome'], | ||
singleRun: false | ||
singleRun: true | ||
}); | ||
}; |
{ | ||
"name": "ngx-slimscroll", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"license": "MIT", | ||
@@ -16,3 +16,3 @@ "main": "./dist/bundles/ngx-slimscroll.umd.js", | ||
"e2e": "ng e2e", | ||
"build:lib": "ng-packagr -p package.json" | ||
"build:lib": "ng-packagr -p ng-package.json" | ||
}, | ||
@@ -54,9 +54,3 @@ "devDependencies": { | ||
"zone.js": "^0.8.14" | ||
}, | ||
"$schema": "./node_modules/ng-packagr/package.schema.json", | ||
"ngPackage": { | ||
"lib": { | ||
"entryFile": "src/public_api.ts" | ||
} | ||
} | ||
} |
@@ -1,27 +0,132 @@ | ||
import { TestBed, async } from '@angular/core/testing'; | ||
import { | ||
inject, | ||
async, | ||
fakeAsync, | ||
tick, | ||
TestBed, | ||
ComponentFixture, | ||
} from '@angular/core/testing'; | ||
import { By } from '@angular/platform-browser'; | ||
import { DebugElement } from '@angular/core'; | ||
import { AppComponent } from './app.component'; | ||
describe('AppComponent', () => { | ||
import { SlimScrollDirective } from './ngx-slimscroll/directives/slimscroll.directive'; | ||
describe(`Slimscroll Directive`, () => { | ||
let comp: AppComponent; | ||
let fixture: ComponentFixture<AppComponent>; | ||
let de: DebugElement; | ||
let dir: SlimScrollDirective; | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
AppComponent | ||
], | ||
declarations: [ AppComponent, SlimScrollDirective ] | ||
}).compileComponents(); | ||
})); | ||
it('should create the app', async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app).toBeTruthy(); | ||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AppComponent); | ||
fixture.detectChanges(); | ||
comp = fixture.componentInstance; | ||
const des = fixture.debugElement.queryAll(By.directive(SlimScrollDirective)); | ||
de = des[0]; | ||
dir = de.injector.get(SlimScrollDirective) as SlimScrollDirective; | ||
fixture.detectChanges(); | ||
}); | ||
it(`should initialized itself`, () => { | ||
expect(fixture).toBeDefined(); | ||
expect(comp).toBeDefined(); | ||
}); | ||
it(`should wrap main element inside '.slimscroll-wrapper'`, () => { | ||
const wrapper = de.parent.query(By.css('.slimscroll-wrapper')); | ||
expect(wrapper).toBeTruthy(); | ||
expect(wrapper.nativeElement.contains(de.nativeElement)).toBeTruthy(); | ||
}); | ||
it(`should apply correct styles on '.slimscroll-wrapper'`, () => { | ||
const wrapper = de.parent.query(By.css('.slimscroll-wrapper')); | ||
expect(wrapper.styles.position).toBe('relative'); | ||
expect(wrapper.styles.overflow).toBe('hidden'); | ||
expect(wrapper.styles.display).toBe('inline-block'); | ||
expect(wrapper.styles.margin).toBe(getComputedStyle(de.nativeElement).margin); | ||
expect(wrapper.styles.width).toBe('100%'); | ||
}); | ||
it(`should initialize '.slimscroll-grid'`, () => { | ||
const grid = de.query(By.css('.slimscroll-grid')); | ||
expect(grid).toBeTruthy(); | ||
}); | ||
xit(`should apply correct styles on '.slimscroll-grid'`, () => { | ||
const grid = de.query(By.css('.slimscroll-grid')); | ||
expect(grid.styles.position).toBe('absolute'); | ||
expect(grid.styles.top).toBe('0'); | ||
expect(grid.styles.bottom).toBe('0'); | ||
expect(grid.styles.right).toBe('0'); | ||
expect(grid.styles.width).toBe(comp.options.gridWidth + 'px'); | ||
expect(grid.styles.background).toBe(comp.options.gridBackground); | ||
expect(grid.styles.opacity).toBe(dir.options.gridOpacity); | ||
expect(grid.styles.display).toBe('block'); | ||
expect(grid.styles.cursor).toBe('pointer'); | ||
expect(grid.styles['z-index']).toBe('99'); | ||
expect(grid.styles['border-radius']).toBe(dir.options.gridBorderRadius + 'px'); | ||
expect(grid.styles.margin).toBe(dir.options.gridMargin); | ||
}); | ||
it(`should initialize '.slimscroll-bar'`, () => { | ||
const bar = de.query(By.css('.slimscroll-bar')); | ||
expect(bar).toBeTruthy(); | ||
}); | ||
xit(`should initialize correct styles on '.slimscroll-bar'`, () => { | ||
const bar = de.query(By.css('.slimscroll-bar')); | ||
expect(bar.styles.position).toBe('absolute'); | ||
expect(bar.styles.top).toBe('0'); | ||
expect(bar.styles.right).toBe('0'); | ||
expect(bar.styles.width).toBe(dir.options.barWidth + 'px'); | ||
expect(bar.styles.background).toBe(dir.options.barBackground); | ||
expect(bar.styles.opacity).toBe(dir.options.barOpacity); | ||
expect(bar.styles.display).toBe('block'); | ||
expect(bar.styles.cursor).toBe('pointer'); | ||
expect(bar.styles['z-index']).toBe('100'); | ||
expect(bar.styles['border-radius']).toBe(dir.options.barBorderRadius + 'px'); | ||
expect(bar.styles.margin).toBe(dir.options.barMargin); | ||
}); | ||
xit(`should set scroll bar style top on 'scrollContent' method`, fakeAsync(() => { | ||
const bar = de.query(By.css('.slimscroll-bar')); | ||
dir.scrollContent(10, true, false); | ||
fixture.detectChanges(); | ||
expect(parseInt(bar.styles.top, 10)).toBeGreaterThan(0); | ||
})); | ||
it(`should have as title 'app'`, async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
const app = fixture.debugElement.componentInstance; | ||
expect(app.title).toEqual('app'); | ||
xit(`should set element scrollTop on 'scrollContent' method`, fakeAsync(() => { | ||
const el = de.parent.query(By.css('.slimscroll-wrapper > div')); | ||
dir.scrollContent(10, true, false); | ||
fixture.detectChanges(); | ||
expect(parseInt(el.nativeElement.scrollTop, 10)).toBeGreaterThan(0); | ||
})); | ||
it('should render title in a h1 tag', async(() => { | ||
const fixture = TestBed.createComponent(AppComponent); | ||
it(`should set scroll bar style top back to 0 on 'scrollContent' method`, fakeAsync(() => { | ||
const bar = de.query(By.css('.slimscroll-bar')); | ||
dir.scrollContent(10, true, false); | ||
fixture.detectChanges(); | ||
const compiled = fixture.debugElement.nativeElement; | ||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); | ||
dir.scrollContent(-10, true, false); | ||
fixture.detectChanges(); | ||
expect(parseInt(bar.styles.top, 10)).toBe(0); | ||
})); | ||
it(`should set element scrollTop back on 0 on 'scrollContent' method`, fakeAsync(() => { | ||
const el = de.parent.query(By.css('.slimscroll-wrapper > div')); | ||
dir.scrollContent(10, true, false); | ||
fixture.detectChanges(); | ||
dir.scrollContent(-10, true, false); | ||
fixture.detectChanges(); | ||
expect(parseInt(el.nativeElement.scrollTop, 10)).toBe(0); | ||
})); | ||
}); |
@@ -1,5 +0,3 @@ | ||
import { NgSlimScrollModule } from './app/ngx-slimscroll/module/ngx-slimscroll.module'; | ||
import { ISlimScrollOptions } from './app/ngx-slimscroll/classes/slimscroll-options.class'; | ||
import { SlimScrollEvent } from './app/ngx-slimscroll/classes/slimscroll-event.class'; | ||
export { NgSlimScrollModule, ISlimScrollOptions, SlimScrollEvent }; | ||
export * from './app/ngx-slimscroll/classes/slimscroll-event.class'; | ||
export * from './app/ngx-slimscroll/classes/slimscroll-options.class'; | ||
export * from './app/ngx-slimscroll/module/ngx-slimscroll.module'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
296842
35
1107
1