#24744 Converted ./components/spinner_button.tsx from Class Component to Function Component (#24804)

* Converted [./components/spinner_button.tsx] to functional component

* Converted [./components/spinner_button.tsx] to functional component

* [./components/spinner_button.tsx]: wrapped the component with react.memo + removed default props + use multi-lines in args

* [./components/spinner_button.tsx]:
- fix lint errors in spinner button
- fix error in missing prop on spinnerButton component

* [./components/spinner_button.tsx]:
- convert class component to functional component - fix lint errors in spinner button

* fix:[spinner_button]: fix lint errors

* - fix: [add_emoji.tsx]: add an id selector to the SpinnerButton to fix issue in unit test for this file.
- fix: [add_emoji.test.tsx]: find the saveButton with id selector instead of using element directly (was causing test fai)
- update test snapshots

* fix[add_emoji]: replaced id with data-testid to be used in unit test

---------

Co-authored-by: Noha M <33437197+NohaaAa@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Noha M
2023-10-31 11:35:01 +02:00
коммит произвёл GitHub
родитель b4c9eddca8
Коммит 3812de0dec
11 изменённых файлов: 63 добавлений и 60 удалений

Просмотреть файл

@@ -419,7 +419,7 @@ exports[`components/integrations/AbstractCommand should match snapshot 1`] = `
id="add_command.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveCommand"
onClick={[Function]}
@@ -431,7 +431,7 @@ exports[`components/integrations/AbstractCommand should match snapshot 1`] = `
defaultMessage="Footer"
id="Footer"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
<div>
renderExtra
</div>
@@ -859,7 +859,7 @@ exports[`components/integrations/AbstractCommand should match snapshot when head
id="add_command.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveCommand"
onClick={[Function]}
@@ -870,7 +870,7 @@ exports[`components/integrations/AbstractCommand should match snapshot when head
<span>
Footer as string
</span>
</SpinnerButton>
</Memo(SpinnerButton)>
<div>
renderExtra
</div>
@@ -1302,7 +1302,7 @@ exports[`components/integrations/AbstractCommand should match snapshot, displays
id="add_command.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveCommand"
onClick={[Function]}
@@ -1314,7 +1314,7 @@ exports[`components/integrations/AbstractCommand should match snapshot, displays
defaultMessage="Footer"
id="Footer"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
<div>
renderExtra
</div>

Просмотреть файл

@@ -242,7 +242,7 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func
id="add_incoming_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -254,7 +254,7 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>
@@ -503,7 +503,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot 1
id="add_incoming_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -515,7 +515,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot 1
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>
@@ -767,7 +767,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
id="add_incoming_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -779,7 +779,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>
@@ -995,7 +995,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
id="add_incoming_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -1007,7 +1007,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>
@@ -1223,7 +1223,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
id="add_incoming_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -1235,7 +1235,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>
@@ -1484,7 +1484,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
id="add_incoming_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -1496,7 +1496,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>

Просмотреть файл

@@ -283,7 +283,7 @@ https://test.com/callback2"
id="installed_oauth_apps.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveOauthApp"
onClick={[Function]}
@@ -295,7 +295,7 @@ https://test.com/callback2"
defaultMessage="Footer"
id="Footer"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
<div>
renderExtra
</div>
@@ -590,7 +590,7 @@ exports[`components/integrations/AbstractOAuthApp should match snapshot, display
id="installed_oauth_apps.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveOauthApp"
onClick={[Function]}
@@ -602,7 +602,7 @@ exports[`components/integrations/AbstractOAuthApp should match snapshot, display
defaultMessage="Footer"
id="Footer"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
<div>
renderExtra
</div>

Просмотреть файл

@@ -328,7 +328,7 @@ callbackUrl2.com
id="add_outgoing_webhook.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveWebhook"
onClick={[Function]}
@@ -340,7 +340,7 @@ callbackUrl2.com
defaultMessage="Footer"
id="footer_id"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>

Просмотреть файл

@@ -337,7 +337,7 @@ exports[`components/integrations/bots/AddBot blank 1`] = `
id="bots.manage.add.cancel"
/>
</Link>
<SpinnerButton
<Memo(SpinnerButton)
className="btn btn-primary"
id="saveBot"
onClick={[Function]}
@@ -354,7 +354,7 @@ exports[`components/integrations/bots/AddBot blank 1`] = `
defaultMessage="Create Bot Account"
id="bots.manage.add.create"
/>
</SpinnerButton>
</Memo(SpinnerButton)>
</div>
</form>
</div>