Skip to content

Commit 90ad9c7

Browse files
Fix selectors for new GitHub issue design (#189)
* Fix selectors for new GitHub issue design * Fix tests and use puppeteer new headless mode
1 parent e5a4eda commit 90ad9c7

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

src/button/button-contributions.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface ButtonContributionParams {
9292
/**
9393
* Additional class names that should be added to the elements.
9494
*/
95-
additionalClassNames?: ("secondary" | "medium" | "left-align-menu")[];
95+
additionalClassNames?: ("secondary" | "medium" | "left-align-menu" | "tall")[];
9696

9797
/**
9898
* A selector that is used to insert the button before a specific element.
@@ -301,7 +301,7 @@ export const buttonContributions: ButtonContributionParams[] = [
301301
},
302302

303303
{
304-
id: "gh-issues",
304+
id: "gh-issue",
305305
exampleUrls: ["https://github.com/svenefftinge/browser-extension-test/issues/1"],
306306
selector: "#partial-discussion-header > div.gh-header-show > div > div",
307307
containerElement: createElement("div", {
@@ -319,7 +319,17 @@ export const buttonContributions: ButtonContributionParams[] = [
319319
],
320320
},
321321
{
322-
id: "gh-pulls",
322+
id: "gh-issue-new", // this isn't referring to "new issue", but to new "issue"
323+
exampleUrls: ["https://github.com/svenefftinge/browser-extension-test/issues/1"],
324+
selector: `xpath://*[@id="js-repo-pjax-container"]/react-app/div/div/div/div/div[1]/div/div/div[3]/div`,
325+
containerElement: createElement("div", {}),
326+
insertBefore: `xpath://*[@id="js-repo-pjax-container"]/react-app/div/div/div/div/div[1]/div/div/div[3]/div/div`,
327+
application: "github",
328+
// we need to make the button higher: the buttons here use 2rem instead of 1.75rem
329+
additionalClassNames: ["tall"],
330+
},
331+
{
332+
id: "gh-pull",
323333
exampleUrls: ["https://github.com/svenefftinge/browser-extension-test/pull/2"],
324334
selector: "#partial-discussion-header > div.gh-header-show > div > div",
325335
containerElement: createElement("div", {

src/button/button.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@
209209
--dropdown-box-shadow: var(--shadow-floating-large, var(--color-shadow-large));
210210
}
211211

212+
.github.tall {
213+
--primary-height: var(--control-medium-size, 2rem);
214+
}
215+
212216
.github .chevron-icon {
213217
padding: 3px;
214218
}

test/src/button-contributions-copy.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface ButtonContributionParams {
9292
/**
9393
* Additional class names that should be added to the elements.
9494
*/
95-
additionalClassNames?: ("secondary" | "medium" | "left-align-menu")[];
95+
additionalClassNames?: ("secondary" | "medium" | "left-align-menu" | "tall")[];
9696

9797
/**
9898
* A selector that is used to insert the button before a specific element.
@@ -301,7 +301,7 @@ export const buttonContributions: ButtonContributionParams[] = [
301301
},
302302

303303
{
304-
id: "gh-issues",
304+
id: "gh-issue",
305305
exampleUrls: ["https://github.com/svenefftinge/browser-extension-test/issues/1"],
306306
selector: "#partial-discussion-header > div.gh-header-show > div > div",
307307
containerElement: createElement("div", {
@@ -319,7 +319,17 @@ export const buttonContributions: ButtonContributionParams[] = [
319319
],
320320
},
321321
{
322-
id: "gh-pulls",
322+
id: "gh-issue-new", // this isn't referring to "new issue", but to new "issue"
323+
exampleUrls: ["https://github.com/svenefftinge/browser-extension-test/issues/1"],
324+
selector: `xpath://*[@id="js-repo-pjax-container"]/react-app/div/div/div/div/div[1]/div/div/div[3]/div`,
325+
containerElement: createElement("div", {}),
326+
insertBefore: `xpath://*[@id="js-repo-pjax-container"]/react-app/div/div/div/div/div[1]/div/div/div[3]/div/div`,
327+
application: "github",
328+
// we need to make the button higher: the buttons here use 2rem instead of 1.75rem
329+
additionalClassNames: ["tall"],
330+
},
331+
{
332+
id: "gh-pull",
323333
exampleUrls: ["https://github.com/svenefftinge/browser-extension-test/pull/2"],
324334
selector: "#partial-discussion-header > div.gh-header-show > div > div",
325335
containerElement: createElement("div", {

test/src/button-contributions.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ describe("Platform match tests", function () {
1010

1111
before(async function () {
1212
browser = await puppeteer.launch({
13-
headless: true,
14-
browser: "chrome",
13+
headless: "new",
1514
});
1615
page = await browser.newPage();
1716
});
@@ -66,8 +65,7 @@ describe("Query Selector Tests", function () {
6665

6766
before(async function () {
6867
browser = await puppeteer.launch({
69-
headless: true,
70-
browser: "chrome",
68+
headless: "new",
7169
});
7270
page = await browser.newPage();
7371
});

0 commit comments

Comments
 (0)