-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(TabbarItem): rename `text` to `label` * test(TabbarItem): update screenshots
- Loading branch information
1 parent
17fc206
commit bfe4df7
Showing
20 changed files
with
131 additions
and
59 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
packages/codemods/src/transforms/v7/__testfixtures__/tabbar-item/basic.input.tsx
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,17 @@ | ||
import { Icon28NewsfeedOutline, Tabbar, TabbarItem } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
|
||
const App = () => { | ||
return ( | ||
<React.Fragment> | ||
<Tabbar style={{ position: 'static', margin: '10px 0' }}> | ||
<TabbarItem selected={true} onClick={() => {}} text="Новости"> | ||
<Icon28NewsfeedOutline /> | ||
</TabbarItem> | ||
<TabbarItem selected={false} onClick={() => {}} text={"Новости"}> | ||
<Icon28NewsfeedOutline /> | ||
</TabbarItem> | ||
</Tabbar> | ||
</React.Fragment> | ||
); | ||
}; |
21 changes: 21 additions & 0 deletions
21
packages/codemods/src/transforms/v7/__tests__/__snapshots__/tabbar-item.ts.snap
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,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`tabbar-item transforms correctly 1`] = ` | ||
"import { Icon28NewsfeedOutline, Tabbar, TabbarItem } from '@vkontakte/vkui'; | ||
import React from 'react'; | ||
const App = () => { | ||
return ( | ||
(<React.Fragment> | ||
<Tabbar style={{ position: 'static', margin: '10px 0' }}> | ||
<TabbarItem selected={true} onClick={() => {}} label="Новости"> | ||
<Icon28NewsfeedOutline /> | ||
</TabbarItem> | ||
<TabbarItem selected={false} onClick={() => {}} label={"Новости"}> | ||
<Icon28NewsfeedOutline /> | ||
</TabbarItem> | ||
</Tabbar> | ||
</React.Fragment>) | ||
); | ||
};" | ||
`; |
12 changes: 12 additions & 0 deletions
12
packages/codemods/src/transforms/v7/__tests__/tabbar-item.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,12 @@ | ||
jest.autoMockOff(); | ||
|
||
import { defineSnapshotTestFromFixture } from '../../../testHelpers/testHelper'; | ||
|
||
const name = 'tabbar-item'; | ||
const fixtures = ['basic'] as const; | ||
|
||
describe(name, () => { | ||
fixtures.forEach((test) => | ||
defineSnapshotTestFromFixture(__dirname, name, global.TRANSFORM_OPTIONS, `${name}/${test}`), | ||
); | ||
}); |
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,18 @@ | ||
import { API, FileInfo } from 'jscodeshift'; | ||
import { getImportInfo, renameProp } from '../../codemod-helpers'; | ||
import { JSCodeShiftOptions } from '../../types'; | ||
|
||
export const parser = 'tsx'; | ||
|
||
export default function transformer(file: FileInfo, api: API, options: JSCodeShiftOptions) { | ||
const { alias } = options; | ||
const j = api.jscodeshift; | ||
const source = j(file.source); | ||
const { localName } = getImportInfo(j, file, 'TabbarItem', alias); | ||
|
||
if (localName) { | ||
renameProp(j, source, localName, { text: 'label' }); | ||
} | ||
|
||
return source.toSource(); | ||
} |
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
Oops, something went wrong.