Skip to content

Commit

Permalink
Merge branch 'bugfix/LF3004/error-message-disappears-on-second-valida…
Browse files Browse the repository at this point in the history
…tion' into 'gh-pages'

error message should stay on second validation

See merge request lfor/ucum!100
  • Loading branch information
jcy1225 committed May 7, 2024
2 parents 19c009e + 10c8071 commit 1dde72f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [demo-1.0.1] 2024-05-03
### Fixed
- An issue where the error message disappears the second time you validate
an invalid code with some variation like a leading "/".

## [demo-1.0.0] 2023-06-01
### Fixed
- Updated ucum-lhc to 5.0.0 to get its fixes.
Expand Down
10 changes: 10 additions & 0 deletions demo-test/cypress/integration/ucumDemo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ describe('UCUM Demo page tests', function(){
// but it was there before this update.
cy.get('#validationString').should('have.text', 'cm (centimeter) is a valid unit expression.');
});

it('should preserve error message on second validation', function() {
cy.visit('docs/demo.html');
cy.get("#valString").should('be.visible').type('acr').type('{enter}');
cy.get('#validationString').should('contain.text', 'acr is not a valid UCUM code.');
cy.get("#valString").clear().type('/acr').type('{enter}');
cy.get('#validationString').should('contain.text', 'acr is not a valid UCUM code.');
cy.get("#valString").clear().type('{enter}');
cy.get('#validationString').should('be.empty');
});
});

describe('Conversion', function() {
Expand Down
4 changes: 2 additions & 2 deletions demo/ucumDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ export class UcumDemo {
} // end if there's a message from the parse request

// If there's a message to be displayed (and it's not a repeat of
// the last displayed message) do it now
if (retMsg !== '' && retMsg !== lastDispMsg) {
// the last displayed message on the converter tab), do it now.
if (retMsg !== '' && (tabName !== 'Converter' || retMsg !== lastDispMsg)) {
if (uStr !== escVal && uStr !== '') {
retMsg = this._multipleReplace(retMsg, uStr, escVal);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/ucum-demo.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/ucum-demo.min.js.map

Large diffs are not rendered by default.

0 comments on commit 1dde72f

Please sign in to comment.