Modify query and store to show subclasses #145
Conversation
02ec46e
to
fe66337
Compare
fe66337
to
9175db1
Compare
tests/unit/sparql/buildQuery.spec.ts
Outdated
it( 'builds a query from a property and a string value with subclasses', () => { | ||
const propertyId = 'P666'; | ||
const value = 'blah'; | ||
const subclassesId = 'P279'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we pass the environment variable here? I tried const subclassesId = process.env.VUE_APP_SUBCLASS_PROPERTY;
and it didnt work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try
process.env = Object.assign(process.env, { VUE_APP_SUBCLASS_PROPERTY: 'value' });
( which I found there: vuejs/vue-test-utils#193 (comment) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uf!! That was hard. The proposed solution wasn't working but this one worked: https://stackoverflow.com/a/58953365/1619792
12e2b51
to
835d801
Compare
28e7b9a
to
c335667
Compare
package-lock.json
Outdated
@@ -4194,19 +4194,19 @@ | |||
"dependencies": { | |||
"ansi-regex": { | |||
"version": "2.1.1", | |||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", | |||
"resolved": "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-2.1.1.tgz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want those changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, missed that one
src/components/QueryCondition.vue
Outdated
@@ -91,9 +91,10 @@ export default Vue.extend( { | |||
if ( selectedProperty === null ) { | |||
this.$store.dispatch( 'unsetProperty', this.conditionIndex ); | |||
return; | |||
} else if ( selectedProperty.datatype === 'wikibase-item' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this else
as the previous if
always returns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if we needed it either.
package.json
Outdated
}, | ||
"jest": { | ||
"setupFiles": [ | ||
"./tests/unit/setEnvVars.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that not be .jest/setEnvVars.js
? I'm confused that the tests are still passing 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this was from another way I tried that didn't work. So this is actually not being used. Thanks for pointing it out.
added envVars file for jest tests files as well
c335667
to
506e9b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We are almost there 🙂
package-lock.json
Outdated
@@ -4200,13 +4200,13 @@ | |||
}, | |||
"ansi-styles": { | |||
"version": "2.2.1", | |||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", | |||
"resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-2.2.1.tgz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean, we don't want to have this file checked in at all for this PR (and also do not want to use registry.npm.taobao.org)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, weird. I thought I removed this.
@@ -102,6 +102,26 @@ describe( 'QueryCondition.vue', () => { | |||
expect( store.dispatch ).toHaveBeenCalledWith( 'updateValue', { value: userInput, conditionIndex } ); | |||
} ); | |||
|
|||
it( 'set subclasses to true when property type is wikibase-item', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test for setting it to false as well if the datatype is string
?
506e9b4
to
c801d24
Compare
c801d24
to
0b25924
Compare
first commit: Modify store to accept subclasses
second commit: modify the query.
third commit: merge
fourth commit: this field should be unchecked by default and should be checked true automatically if and only if the user selects a wikibase-item property