Units: support farenheit (existing misspelling) (#21249)

(cherry picked from commit af2cd77655)
This commit is contained in:
Ryan McKinley
2020-01-15 10:36:39 +01:00
committed by Andrej Ocenas
parent a8707bbc0e
commit 54044155a5
2 changed files with 16 additions and 0 deletions
@@ -53,4 +53,12 @@ describe('valueFormats', () => {
expect(str).toBe('1.200 s');
});
});
describe('Resolve old units', () => {
it('resolve farenheit', () => {
const fmt0 = getValueFormat('farenheit');
const fmt1 = getValueFormat('fahrenheit');
expect(fmt0).toEqual(fmt1);
});
});
});
@@ -142,6 +142,14 @@ function buildFormats() {
}
}
// Resolve units pointing to old IDs
[{ from: 'farenheit', to: 'fahrenheit' }].forEach(alias => {
const f = index[alias.to];
if (f) {
index[alias.from] = f;
}
});
hasBuiltIndex = true;
}