Skip to content

Commit

Permalink
Data validation: allow multiple_versions_without_translations (#232)
Browse files Browse the repository at this point in the history
This is a valid value that I missed when I upgraded this code.

Solves issue reported at
pypa/pipx#698 (comment)
  • Loading branch information
humitos authored Jan 17, 2024
1 parent a3f89f5 commit b59eb1d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dist/readthedocs-addons.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/readthedocs-addons.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/data-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ const addons_flyout = {
versioning_scheme: {
enum: [
"multiple_versions_with_translations",
"multiple_versions_without_translations",
"single_version_without_translations",
],
},
Expand Down Expand Up @@ -287,6 +288,7 @@ const addons_notifications = {
versioning_scheme: {
enum: [
"multiple_versions_with_translations",
"multiple_versions_without_translations",
"single_version_without_translations",
],
},
Expand Down
32 changes: 32 additions & 0 deletions tests/flyout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,38 @@ describe("Flyout addon", () => {
}),
).to.be.true;
});

// This test is a copy of the previous one.
// We should probably create a `config` variable and adapt it depending on the test,
// instead of duplicating the whole object.
it("enabled with multiple_versions_without_translations", () => {
expect(
FlyoutAddon.isEnabled({
addons: {
flyout: {
enabled: true,
downloads: [],
translations: [],
versions: [],
},
},
domains: {
dashboard: "readthedocs.org",
},
projects: {
current: {
slug: "project",
versioning_scheme: "multiple_versions_without_translations",
},
},
versions: {
current: {
slug: "latest",
},
},
}),
).to.be.true;
});
});

describe("Flyout element", () => {
Expand Down

0 comments on commit b59eb1d

Please sign in to comment.