mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
feat(angular-wizard): setEditMode method definition (#41244)
- docs - test Thanks!s
This commit is contained in:
committed by
Ryan Cavanaugh
parent
c1bea6ce63
commit
bf8cc8a772
@@ -6,6 +6,7 @@ import * as ng from "angular";
|
||||
import * as angular from "angular";
|
||||
|
||||
interface IWizardScope extends ng.IScope {
|
||||
editMode: boolean;
|
||||
referenceCurrentStep: string;
|
||||
stepValidation: () => void;
|
||||
finishedWizard: () => void;
|
||||
@@ -30,7 +31,8 @@ describe('AngularWizard', function () {
|
||||
*/
|
||||
function createGenericView(scope: IWizardScope) {
|
||||
scope.referenceCurrentStep = null;
|
||||
var element = angular.element('<wizard on-finish="finishedWizard()" current-step="referenceCurrentStep" ng-init="msg = 14" >'
|
||||
scope.editMode = false;
|
||||
var element = angular.element('<wizard on-finish="finishedWizard()" current-step="referenceCurrentStep" ng-init="msg = 14" edit-mode="editMode">'
|
||||
+ ' <wz-step wz-title="Starting" canenter="enterValidation" description="Step description">'
|
||||
+ ' <h1>This is the first step</h1>'
|
||||
+ ' <p>Here you can use whatever you want. You can use other directives, binding, etc.</p>'
|
||||
@@ -306,4 +308,13 @@ describe('AngularWizard', function () {
|
||||
var view = createGenericView(scope);
|
||||
expect((<any>view.isolateScope()).steps[0].description).toEqual('Step description');
|
||||
});
|
||||
it("should set edit mode through custom method", () => {
|
||||
const scope = <IWizardScope>$rootScope.$new();
|
||||
scope.editMode = true;
|
||||
createGenericView(scope);
|
||||
expect(scope.editMode).toBeTrue();
|
||||
WizardHandler.wizard().setEditMode(false);
|
||||
$rootScope.$digest();
|
||||
expect(scope.editMode).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
6
types/angular-wizard/index.d.ts
vendored
6
types/angular-wizard/index.d.ts
vendored
@@ -29,6 +29,12 @@ declare module 'angular' {
|
||||
currentStepTitle: () => string;
|
||||
getEnabledSteps(): WzStep[];
|
||||
totalStepCount(): number;
|
||||
/** Set the edit mode of the wizard.
|
||||
* Setting editMode to `true` will make ALL steps accessible,
|
||||
* setting edit mode to `false` will make all steps with an index lower than
|
||||
* the latest "completed" step accessible.
|
||||
*/
|
||||
setEditMode(editMode: boolean): void;
|
||||
}
|
||||
|
||||
interface WzStep {
|
||||
|
||||
Reference in New Issue
Block a user