mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make preferences from extensions using tabs "application" and "telemetry" appear as last (#6674)
This commit is contained in:
parent
1e0094bd8e
commit
75aee7e4fd
@ -861,37 +861,6 @@ exports[`preferences - navigation to application preferences given in preference
|
||||
>
|
||||
Application
|
||||
</h2>
|
||||
<div
|
||||
data-preference-item-test="preference-item-for-extension-some-test-extension-name-item-some-application-preference-item-id"
|
||||
>
|
||||
<section
|
||||
class="small"
|
||||
id="some-application-preference-item-id"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Some application-preference item
|
||||
|
||||
</div>
|
||||
<div
|
||||
data-testid="some-preference-item-input"
|
||||
/>
|
||||
<div
|
||||
class="hint"
|
||||
>
|
||||
<div
|
||||
data-testid="some-preference-item-hint"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
<hr
|
||||
class="small"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="HorizontalLine size-xl"
|
||||
/>
|
||||
<div
|
||||
data-preference-item-test="theme"
|
||||
>
|
||||
@ -1307,6 +1276,37 @@ exports[`preferences - navigation to application preferences given in preference
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div
|
||||
class="HorizontalLine size-xl"
|
||||
/>
|
||||
<div
|
||||
data-preference-item-test="preference-item-for-extension-some-test-extension-name-item-some-application-preference-item-id"
|
||||
>
|
||||
<section
|
||||
class="small"
|
||||
id="some-application-preference-item-id"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Some application-preference item
|
||||
|
||||
</div>
|
||||
<div
|
||||
data-testid="some-preference-item-input"
|
||||
/>
|
||||
<div
|
||||
class="hint"
|
||||
>
|
||||
<div
|
||||
data-testid="some-preference-item-hint"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
<hr
|
||||
class="small"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div
|
||||
|
||||
@ -56,11 +56,11 @@ describe("preferences - navigation to application preferences", () => {
|
||||
expect(rendered.container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("shows preference items of the extension", () => {
|
||||
it("shows preference items of the extension as last", () => {
|
||||
const { attributeValues } =
|
||||
discover.queryAllElements("preference-item");
|
||||
|
||||
expect(attributeValues).toContain("preference-item-for-extension-some-test-extension-name-item-some-application-preference-item-id");
|
||||
expect(attributeValues.at(-1)).toBe("preference-item-for-extension-some-test-extension-name-item-some-application-preference-item-id");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -113,6 +113,12 @@ const registratorForPreferenceItemsInjectable = getInjectable({
|
||||
const items = extension.appPreferences.map((registration, i) => {
|
||||
const itemId = `${commonId}-item-${registration.id ?? i}`;
|
||||
|
||||
const itemIsInSpecialTab =
|
||||
registration.showInPreferencesTab &&
|
||||
["telemetry", "application"].includes(
|
||||
registration.showInPreferencesTab,
|
||||
);
|
||||
|
||||
return getInjectable({
|
||||
id: itemId,
|
||||
|
||||
@ -122,12 +128,12 @@ const registratorForPreferenceItemsInjectable = getInjectable({
|
||||
|
||||
// Note: Legacy extensions considered telemetry and application as magic strings, and so does this code
|
||||
parentId: registration.showInPreferencesTab
|
||||
? ["telemetry", "application"].includes(registration.showInPreferencesTab)
|
||||
? itemIsInSpecialTab
|
||||
? `${registration.showInPreferencesTab}-page`
|
||||
: `${commonId}-additional-page-${registration.showInPreferencesTab}`
|
||||
: primaryPageId,
|
||||
|
||||
orderNumber: i * 10,
|
||||
orderNumber: i * 10 + (itemIsInSpecialTab ? 1000 : 0),
|
||||
|
||||
Component: () => (
|
||||
<ExtensionPreferenceBlock registration={registration} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user