Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with testing-library-selector #371

Closed
AlexKrupko opened this issue May 20, 2024 · 2 comments
Closed

Doesn't work with testing-library-selector #371

AlexKrupko opened this issue May 20, 2024 · 2 comments

Comments

@AlexKrupko
Copy link

The following code doesn't warn any errors:

import {byRole} from 'testing-library-selector';

const ui = {
    input: byRole('textbox');
};

test('test', () => {
    render(<input />);
    expect(ui.input.get()).toHaveAttribute('disabled'); // <--- no errors here 
});

Is it possible to use these rules when screen.getBy... methods are not used directly as an element?

@G-Rath
Copy link
Collaborator

G-Rath commented May 20, 2024

No, I don't see a good way we could support this given you're importing from testing-library-selector, the import is ByRole (rather than getByRole), and the argument to expect is ui.input.get() which is very generic - it might be more possible if we TypeScript based, but then it would require everyone to use TypeScript.

@AlexKrupko
Copy link
Author

Yes, I thought this is impossible. So, we'll have to exclude this plugin from the project then.
Also, I don't think that Typescript can help somehow here...
Anyway, thank you for the response @G-Rath.

@AlexKrupko AlexKrupko closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants