Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module: carousel):
nzLoop
to prevent the carousel to go in a l…
…oop (#7693) * feat(module: carousel): `nzLoop` to prevent the carousel to go in a loop * ci(module: carousel): improve test coverage
- Loading branch information
Showing
8 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 5 | ||
title: | ||
zh-CN: 循环 | ||
en-US: Loop | ||
--- | ||
|
||
## zh-CN | ||
|
||
防止轮播进入循环 | ||
|
||
## en-US | ||
|
||
Prevent the carousel to go in a loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-carousel-loop', | ||
template: ` | ||
<nz-carousel nzAutoPlay [nzEffect]="effect" [nzLoop]="false"> | ||
<div nz-carousel-content *ngFor="let index of array"> | ||
<h3>{{ index }}</h3> | ||
</div> | ||
</nz-carousel> | ||
`, | ||
styles: [ | ||
` | ||
[nz-carousel-content] { | ||
text-align: center; | ||
height: 160px; | ||
line-height: 160px; | ||
background: #364d79; | ||
color: #fff; | ||
overflow: hidden; | ||
} | ||
h3 { | ||
color: #fff; | ||
margin-bottom: 0; | ||
user-select: none; | ||
} | ||
` | ||
] | ||
}) | ||
export class NzDemoCarouselLoopComponent { | ||
array = [1, 2, 3, 4]; | ||
effect = 'scrollx'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { pxToNumber } from './text-measure'; | ||
|
||
describe('pxToNumber', () => { | ||
it('should return 0 when value is null', () => { | ||
expect(pxToNumber(null)).toBe(0); | ||
}); | ||
}); |