-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24419 from storybookjs/version-non-patch-from-7.5…
….0-alpha.5 Release: Prerelease 7.5.0-alpha.6
- Loading branch information
Showing
103 changed files
with
1,032 additions
and
1,075 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
16.20 | ||
18.18 |
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
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
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
102 changes: 102 additions & 0 deletions
102
code/frameworks/angular/src/client/argsToTemplate.test.ts
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,102 @@ | ||
import { argsToTemplate, ArgsToTemplateOptions } from './argsToTemplate'; // adjust path | ||
|
||
describe('argsToTemplate', () => { | ||
it('should correctly convert args to template string and exclude undefined values', () => { | ||
const args: Record<string, any> = { | ||
prop1: 'value1', | ||
prop2: undefined, | ||
prop3: 'value3', | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = {}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1" [prop3]="prop3"'); | ||
}); | ||
|
||
it('should include properties from include option', () => { | ||
const args = { | ||
prop1: 'value1', | ||
prop2: 'value2', | ||
prop3: 'value3', | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = { | ||
include: ['prop1', 'prop3'], | ||
}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1" [prop3]="prop3"'); | ||
}); | ||
|
||
it('should include non-undefined properties from include option', () => { | ||
const args: Record<string, any> = { | ||
prop1: 'value1', | ||
prop2: 'value2', | ||
prop3: undefined, | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = { | ||
include: ['prop1', 'prop3'], | ||
}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1"'); | ||
}); | ||
|
||
it('should exclude properties from exclude option', () => { | ||
const args = { | ||
prop1: 'value1', | ||
prop2: 'value2', | ||
prop3: 'value3', | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = { | ||
exclude: ['prop2'], | ||
}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1" [prop3]="prop3"'); | ||
}); | ||
|
||
it('should exclude properties from exclude option and undefined properties', () => { | ||
const args: Record<string, any> = { | ||
prop1: 'value1', | ||
prop2: 'value2', | ||
prop3: undefined, | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = { | ||
exclude: ['prop2'], | ||
}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1"'); | ||
}); | ||
|
||
it('should prioritize include over exclude when both options are given', () => { | ||
const args = { | ||
prop1: 'value1', | ||
prop2: 'value2', | ||
prop3: 'value3', | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = { | ||
include: ['prop1', 'prop2'], | ||
exclude: ['prop2', 'prop3'], | ||
}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1" [prop2]="prop2"'); | ||
}); | ||
|
||
it('should work when neither include nor exclude options are given', () => { | ||
const args = { | ||
prop1: 'value1', | ||
prop2: 'value2', | ||
}; | ||
const options: ArgsToTemplateOptions<keyof typeof args> = {}; | ||
const result = argsToTemplate(args, options); | ||
expect(result).toBe('[prop1]="prop1" [prop2]="prop2"'); | ||
}); | ||
|
||
it('should bind events correctly when value is a function', () => { | ||
const args = { event1: () => {}, event2: () => {} }; | ||
const result = argsToTemplate(args, {}); | ||
expect(result).toEqual('(event1)="event1($event)" (event2)="event2($event)"'); | ||
}); | ||
|
||
it('should mix properties and events correctly', () => { | ||
const args = { input: 'Value1', event1: () => {} }; | ||
const result = argsToTemplate(args, {}); | ||
expect(result).toEqual('[input]="input" (event1)="event1($event)"'); | ||
}); | ||
}); |
Oops, something went wrong.