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

Bug: text input truncated in detail component tests #162

Open
kburk1997 opened this issue Feb 8, 2018 · 0 comments
Open

Bug: text input truncated in detail component tests #162

kburk1997 opened this issue Feb 8, 2018 · 0 comments

Comments

@kburk1997
Copy link
Member

I discovered this bug while implementing tests for the course detail page. Any input over 30 characters in input fields is truncated when read as an attribute. This bug is addressed in the issue-120 branch in the course detail tests, but may still exist in the other detail tests.

How to reproduce this bug:

In any detail component spec, edit any text field in the object to be over 30 characters long. The test should fail as it will be comparing truncated input to the full data.

Known fix:

The test spec itself should look something like this:

expect([arbitraryElem].getAttribute('ng-reflect-model'))
  .toMatch(component.[object].[attribute]);

Note: [arbitraryElem], [object], and [attribute] are all arbitrary.

The test still passes as intended when the input is under 30 characters. In cases like course descriptions and even some course names, we will run into input that is over 30 characters. To get the test to pass regardless of input length, change the test to:

expect([arbitraryElem].getAttribute('ng-reflect-model'))
  .toMatch(component.[object].[attribute],substr(0,30));

This fix is already implemented in the course-detail component, but needs to be implemented in school-detail, department-detail, and in the future section-detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant