-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move tab state to editor context (#2452)
- Loading branch information
1 parent
8241f56
commit ee0fd8b
Showing
15 changed files
with
531 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@graphiql/react': minor | ||
'graphiql': patch | ||
--- | ||
|
||
Move tab state from `graphiql` into editor context from `@graphiql/react` |
26 changes: 13 additions & 13 deletions
26
...ests__/fuzzyExtractOperationTitle.spec.ts → ...l-react/src/editor/__tests__/tabs.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
import { fuzzyExtractOperationTitle } from '../fuzzyExtractOperationTitle'; | ||
import { fuzzyExtractOperationName } from '../tabs'; | ||
|
||
describe('fuzzyExtractionOperationTitle', () => { | ||
describe('without prefix', () => { | ||
it('should extract query names', () => { | ||
expect(fuzzyExtractOperationTitle('query MyExampleQuery() {}')).toEqual( | ||
expect(fuzzyExtractOperationName('query MyExampleQuery() {}')).toEqual( | ||
'MyExampleQuery', | ||
); | ||
}); | ||
it('should extract query names with special characters', () => { | ||
expect(fuzzyExtractOperationTitle('query My_ExampleQuery() {}')).toEqual( | ||
expect(fuzzyExtractOperationName('query My_ExampleQuery() {}')).toEqual( | ||
'My_ExampleQuery', | ||
); | ||
}); | ||
it('should extract query names with numbers', () => { | ||
expect(fuzzyExtractOperationTitle('query My_3xampleQuery() {}')).toEqual( | ||
expect(fuzzyExtractOperationName('query My_3xampleQuery() {}')).toEqual( | ||
'My_3xampleQuery', | ||
); | ||
}); | ||
it('should extract mutation names with numbers', () => { | ||
expect( | ||
fuzzyExtractOperationTitle('mutation My_3xampleQuery() {}'), | ||
fuzzyExtractOperationName('mutation My_3xampleQuery() {}'), | ||
).toEqual('My_3xampleQuery'); | ||
}); | ||
}); | ||
describe('with space prefix', () => { | ||
it('should extract query names', () => { | ||
expect(fuzzyExtractOperationTitle(' query MyExampleQuery() {}')).toEqual( | ||
expect(fuzzyExtractOperationName(' query MyExampleQuery() {}')).toEqual( | ||
'MyExampleQuery', | ||
); | ||
}); | ||
it('should extract query names with special characters', () => { | ||
expect(fuzzyExtractOperationTitle(' query My_ExampleQuery() {}')).toEqual( | ||
expect(fuzzyExtractOperationName(' query My_ExampleQuery() {}')).toEqual( | ||
'My_ExampleQuery', | ||
); | ||
}); | ||
it('should extract query names with numbers', () => { | ||
expect(fuzzyExtractOperationTitle(' query My_3xampleQuery() {}')).toEqual( | ||
expect(fuzzyExtractOperationName(' query My_3xampleQuery() {}')).toEqual( | ||
'My_3xampleQuery', | ||
); | ||
}); | ||
it('should extract mutation names with numbers', () => { | ||
expect( | ||
fuzzyExtractOperationTitle(' mutation My_3xampleQuery() {}'), | ||
fuzzyExtractOperationName(' mutation My_3xampleQuery() {}'), | ||
).toEqual('My_3xampleQuery'); | ||
}); | ||
}); | ||
|
||
it('should return null for anonymous queries', () => { | ||
expect(fuzzyExtractOperationTitle('{}')).toEqual('<untitled>'); | ||
expect(fuzzyExtractOperationName('{}')).toBeNull(); | ||
}); | ||
it('should not extract query names with comments', () => { | ||
expect(fuzzyExtractOperationTitle('# query My_3xampleQuery() {}')).toEqual( | ||
'<untitled>', | ||
); | ||
expect( | ||
fuzzyExtractOperationName('# query My_3xampleQuery() {}'), | ||
).toBeNull(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.