mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 21:15:24 +08:00
test(clickblock): add new tests for minDuration
This commit is contained in:
@ -409,6 +409,57 @@ describe('App', () => {
|
|||||||
// 700 is the default
|
// 700 is the default
|
||||||
expect(mockClickBlock.activate).toHaveBeenCalledWith(true, 700 + 64, 0);
|
expect(mockClickBlock.activate).toHaveBeenCalledWith(true, 700 + 64, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should enable click block when false is passed with a duration of 0 and with a minDuration', () => {
|
||||||
|
// arrange
|
||||||
|
let mockClickBlock: any = {
|
||||||
|
activate: () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(mockClickBlock, 'activate');
|
||||||
|
|
||||||
|
app._clickBlock = mockClickBlock;
|
||||||
|
|
||||||
|
// act
|
||||||
|
app.setEnabled(false, 0, 400);
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(mockClickBlock.activate).toHaveBeenCalledWith(true, 64, 400);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should enable click block when false is passed with a null duration and a minDuration', () => {
|
||||||
|
// arrange
|
||||||
|
let mockClickBlock: any = {
|
||||||
|
activate: () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(mockClickBlock, 'activate');
|
||||||
|
|
||||||
|
app._clickBlock = mockClickBlock;
|
||||||
|
|
||||||
|
// act
|
||||||
|
app.setEnabled(false, null, 400);
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(mockClickBlock.activate).toHaveBeenCalledWith(true, 64, 400);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should enable click block when false is passed with a duration and a minDuration', () => {
|
||||||
|
// arrange
|
||||||
|
let mockClickBlock: any = {
|
||||||
|
activate: () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
spyOn(mockClickBlock, 'activate');
|
||||||
|
|
||||||
|
app._clickBlock = mockClickBlock;
|
||||||
|
|
||||||
|
// act
|
||||||
|
app.setEnabled(false, 200, 400);
|
||||||
|
|
||||||
|
// assert
|
||||||
|
expect(mockClickBlock.activate).toHaveBeenCalledWith(true, 200 + 64, 400);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var app: App;
|
var app: App;
|
||||||
|
Reference in New Issue
Block a user