1import FixtureSet from '../../FixtureSet';2import TestCase from '../../TestCase';3import NumberTestCase from './NumberTestCase';4import NumberInputDecimal from './NumberInputDecimal';5import NumberInputExtraZeroes from './NumberInputExtraZeroes';67const React = window.React;89function NumberInputs() {10 return (11 <FixtureSet12 title="Number inputs"13 description="Number inputs inconsistently assign and report the value14 property depending on the browser.">15 <TestCase16 title="Backspacing"17 description="The decimal place should not be lost">18 <TestCase.Steps>19 <li>Type "3.1"</li>20 <li>Press backspace, eliminating the "1"</li>21 </TestCase.Steps>2223 <TestCase.ExpectedResult>24 The field should read "3.", preserving the decimal place25 </TestCase.ExpectedResult>2627 <NumberTestCase />2829 <p className="footnote">30 <b>Notes:</b> Modern Chrome and Safari {'<='} 6 clear trailing31 decimals on blur. React makes this concession so that the value32 attribute remains in sync with the value property.33 </p>34 </TestCase>3536 <TestCase37 title="Decimal precision"38 description="Supports decimal precision greater than 2 places">39 <TestCase.Steps>40 <li>Type "0.01"</li>41 </TestCase.Steps>4243 <TestCase.ExpectedResult>44 The field should read "0.01"45 </TestCase.ExpectedResult>4647 <NumberTestCase />48 </TestCase>4950 <TestCase51 title="Exponent form"52 description="Supports exponent form ('2e4')">53 <TestCase.Steps>54 <li>Type "2e"</li>55 <li>Type 4, to read "2e4"</li>56 </TestCase.Steps>5758 <TestCase.ExpectedResult>59 The field should read "2e4". The parsed value should read "20000"60 </TestCase.ExpectedResult>6162 <NumberTestCase />63 </TestCase>6465 <TestCase title="Exponent Form" description="Pressing 'e' at the end">66 <TestCase.Steps>67 <li>Type "3.14"</li>68 <li>Press "e", so that the input reads "3.14e"</li>69 </TestCase.Steps>7071 <TestCase.ExpectedResult>72 The field should read "3.14e", the parsed value should be empty73 </TestCase.ExpectedResult>7475 <NumberTestCase />76 </TestCase>7778 <TestCase79 title="Exponent Form"80 description="Supports pressing 'ee' in the middle of a number">81 <TestCase.Steps>82 <li>Type "3.14"</li>83 <li>Move the text cursor to after the decimal place</li>84 <li>Press "e" twice, so that the value reads "3.ee14"</li>85 </TestCase.Steps>8687 <TestCase.ExpectedResult>88 The field should read "3.ee14"89 </TestCase.ExpectedResult>9091 <NumberTestCase />92 </TestCase>9394 <TestCase95 title="Trailing Zeroes"96 description="Typing '3.0' preserves the trailing zero">97 <TestCase.Steps>98 <li>Type "3.0"</li>99 </TestCase.Steps>100101 <TestCase.ExpectedResult>102 The field should read "3.0"103 </TestCase.ExpectedResult>104105 <NumberTestCase />106 </TestCase>107108 <TestCase109 title="Inserting decimals precision"110 description="Inserting '.' in to '300' maintains the trailing zeroes">111 <TestCase.Steps>112 <li>Type "300"</li>113 <li>Move the cursor to after the "3"</li>114 <li>Type "."</li>115 </TestCase.Steps>116117 <TestCase.ExpectedResult>118 The field should read "3.00", not "3"119 </TestCase.ExpectedResult>120 <NumberTestCase />121 </TestCase>122123 <TestCase124 title="Replacing numbers with -"125 description="Replacing a number with the '-' sign should not clear the value">126 <TestCase.Steps>127 <li>Type "3"</li>128 <li>Select the entire value"</li>129 <li>Type '-' to replace '3' with '-'</li>130 </TestCase.Steps>131132 <TestCase.ExpectedResult>133 The field should read "-", not be blank.134 </TestCase.ExpectedResult>135 <NumberTestCase />136 </TestCase>137138 <TestCase139 title="Negative numbers"140 description="Typing minus when inserting a negative number should work">141 <TestCase.Steps>142 <li>Type "-"</li>143 <li>Type '3'</li>144 </TestCase.Steps>145146 <TestCase.ExpectedResult>147 The field should read "-3".148 </TestCase.ExpectedResult>149 <NumberTestCase />150 </TestCase>151 <TestCase152 title="Decimal numbers"153 description="eg: initial value is '.98', when format to '0.98', should change to '0.98' ">154 <TestCase.Steps>155 <li>initial value is '.98'</li>156 <li>setState to '0.98'</li>157 </TestCase.Steps>158159 <TestCase.ExpectedResult>160 the input value should be '0.98'.161 </TestCase.ExpectedResult>162 <NumberInputDecimal />163 </TestCase>164165 <TestCase166 title="Trailing zeroes"167 description="Extraneous zeroes should be retained when changing the value via setState">168 <TestCase.Steps>169 <li>Change the text to 4.0000</li>170 <li>Click "Reset to 3.0000"</li>171 </TestCase.Steps>172173 <TestCase.ExpectedResult>174 The field should read 3.0000, not 3175 </TestCase.ExpectedResult>176177 <NumberInputExtraZeroes />178179 <p className="footnote">180 <b>Notes:</b> Firefox drops extraneous zeroes when assigned. Zeroes181 are preserved when editing, however directly assigning a new value182 will drop zeroes. This{' '}183 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1003896">184 is a bug in Firefox185 </a>{' '}186 that we can not control for.187 </p>188 </TestCase>189 </FixtureSet>190 );191}192193export default NumberInputs;
Findings
✓ No findings reported for this file.