Skip to content

Commit

Permalink
♻️ Use minHeight option rather than minimumHeight
Browse files Browse the repository at this point in the history
The config and all public facing docs specify min-height, but the API expects minimum-height. This
confusion caused minHeight to not be accounted for since all methods dealing with the API were
looking for minimumHeight.
  • Loading branch information
wwilsman committed Aug 20, 2020
1 parent 5be796e commit 6b9cf5d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/cli-upload/src/commands/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class Upload extends Command {
await this.client.sendSnapshot({
// width and height is clamped to API min and max
widths: [Math.max(10, Math.min(width, 2000))],
minimumHeight: Math.max(10, Math.min(height, 2000)),
minHeight: Math.max(10, Math.min(height, 2000)),
resources: createImageResources(name, buffer, width, height),
name
});
Expand Down
2 changes: 1 addition & 1 deletion packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ await client.createBuild()
await client.sendSnapshot({
name,
widths,
minimumHeight,
minHeight,
enableJavaScript,
clientInfo,
environmentInfo,
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export default class PercyClient {
async createSnapshot({
name,
widths,
minimumHeight,
minHeight,
enableJavaScript,
clientInfo,
environmentInfo,
Expand All @@ -305,7 +305,7 @@ export default class PercyClient {
attributes: {
name: name || null,
widths: widths || null,
'minimum-height': minimumHeight || null,
'minimum-height': minHeight || null,
'enable-javascript': enableJavaScript || null
},
relationships: {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ describe('PercyClient', () => {
.createSnapshot({
name: 'snapfoo',
widths: [1000],
minimumHeight: 1000,
minHeight: 1000,
enableJavaScript: true,
clientInfo: 'sdk/info',
environmentInfo: 'sdk/env',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ percy.snapshot({
url: 'http://localhost:3000', // required url
domSnapshot: domSnapshot, // required DOM string
widths: [500, 1280], // widths to discover resources
minimumHeight: 1024, // minimum height used when screenshotting
minHeight: 1024, // minimum height used when screenshotting
percyCSS: '', // percy specific css to inject
requestHeaders: {}, // asset request headers such as authorization
clientInfo: '', // user-agent client info for the SDK
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/percy.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class Percy {
name,
domSnapshot,
widths,
minimumHeight,
minHeight,
percyCSS,
requestHeaders,
enableJavaScript,
Expand All @@ -188,7 +188,7 @@ export default class Percy {
// normalize the URL
url = normalizeURL(url);
// fallback to instance minimum height
minimumHeight = minimumHeight ?? this.config.snapshot.minimumHeight;
minHeight = minHeight ?? this.config.snapshot.minHeight;
// combine snapshot Percy CSS with instance Percy CSS
percyCSS = [this.config.snapshot.percyCSS, percyCSS].filter(Boolean).join('\n');
// combine snapshot request headers with instance request headers
Expand Down Expand Up @@ -248,7 +248,7 @@ export default class Percy {
this.#snapshots.push(() => this.client.sendSnapshot({
name,
widths,
minimumHeight,
minHeight,
enableJavaScript,
clientInfo,
environmentInfo,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Pojo { [x: string]: any; }

export interface SnapshotOptions {
widths?: number[];
minimumHeight?: number;
minHeight?: number;
percyCSS?: string;
requestHeaders?: Pojo;
enableJavaScript?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const percyOptions: PercyOptions = {
config: '.percy.yml',
snapshot: {
widths: [1280],
minimumHeight: 1024,
minHeight: 1024,
percyCSS: '.percy { color: purple; }',
requestHeaders: { Authorization: 'foobar' },
enableJavaScript: false
Expand Down Expand Up @@ -60,7 +60,7 @@ expectType<void>(await percy.snapshot({
url: 'http://localhost:3000',
domSnapshot: '...',
widths: [1000],
minimumHeight: 1000,
minHeight: 1000,
percyCSS: '.foo { font-weight: 900; }',
requestHeaders: { 'x-testing': 'test' },
enableJavaScript: true
Expand Down Expand Up @@ -101,7 +101,7 @@ expectType<void>(await percy.capture({
execute: async page => {}
}],
widths: [1000],
minimumHeight: 1000,
minHeight: 1000,
percyCSS: '.foo { font-weight: 900; }',
requestHeaders: { 'x-testing': 'test' },
enableJavaScript: true
Expand Down

0 comments on commit 6b9cf5d

Please sign in to comment.