Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

UX: Automatically convert to lowercase in explorer-schema #325

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/components/explorer-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default class ExplorerSchema extends Component {

@debounce(500)
updateFilter(value) {
this.filter = value;
this.filter = value.toLowerCase();
this.loading = false;
}

Expand Down
64 changes: 64 additions & 0 deletions test/javascripts/components/explorer-schema-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { fillIn, render } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";

const schema = {
posts: [
{
column_name: "id",
data_type: "serial",
primary: true,
notes: "primary key",
havetypeinfo: true,
},
{
column_name: "raw",
data_type: "text",
column_desc: "The raw Markdown that the user entered into the composer.",
havepopup: true,
havetypeinfo: true,
},
],
categories: [
{
column_name: "id",
data_type: "serial",
primary: true,
notes: "primary key",
havetypeinfo: true,
},
{
column_name: "name",
data_type: "varchar(50)",
havetypeinfo: false,
},
],
};

module("Data Explorer Plugin | Component | explorer-schema", function (hooks) {
setupRenderingTest(hooks);

test("will automatically convert to lowercase", async function (assert) {
this.setProperties({
schema,
hideSchema: false,
updateHideSchema: () => {},
});

await render(hbs`
<ExplorerSchema
@schema={{this.schema}}
@hideSchema={{this.hideSchema}}
@updateHideSchema={{this.updateHideSchema}}
/>`);

await fillIn(`.schema-search input`, "Cat");

assert.dom(".schema-table").exists();

await fillIn(`.schema-search input`, "NotExist");

assert.dom(".schema-table").doesNotExist();
});
});