9
9
10
10
'use strict' ;
11
11
12
- // Fix JSDOM. setAttribute is supposed to throw on things that can't be implicitly toStringed.
13
- const setAttribute = Element . prototype . setAttribute ;
14
- Element . prototype . setAttribute = function ( name , value ) {
15
- // eslint-disable-next-line react-internal/safe-string-coercion
16
- return setAttribute . call ( this , name , '' + value ) ;
17
- } ;
18
-
19
12
describe ( 'ReactDOMSelect' , ( ) => {
20
13
let React ;
21
14
let ReactDOM ;
@@ -856,7 +849,7 @@ describe('ReactDOMSelect', () => {
856
849
} ) ;
857
850
858
851
describe ( 'When given a Symbol value' , ( ) => {
859
- it ( 'treats initial Symbol value as missing ' , ( ) => {
852
+ it ( 'treats initial Symbol value as an empty string ' , ( ) => {
860
853
let node ;
861
854
862
855
expect ( ( ) => {
@@ -869,10 +862,10 @@ describe('ReactDOMSelect', () => {
869
862
) ;
870
863
} ) . toErrorDev ( 'Invalid value for prop `value`' ) ;
871
864
872
- expect ( node . value ) . toBe ( 'A Symbol! ' ) ;
865
+ expect ( node . value ) . toBe ( '' ) ;
873
866
} ) ;
874
867
875
- it ( 'treats updated Symbol value as missing ' , ( ) => {
868
+ it ( 'treats updated Symbol value as an empty string ' , ( ) => {
876
869
let node ;
877
870
878
871
expect ( ( ) => {
@@ -895,7 +888,7 @@ describe('ReactDOMSelect', () => {
895
888
</ select > ,
896
889
) ;
897
890
898
- expect ( node . value ) . toBe ( 'A Symbol! ' ) ;
891
+ expect ( node . value ) . toBe ( '' ) ;
899
892
} ) ;
900
893
901
894
it ( 'treats initial Symbol defaultValue as an empty string' , ( ) => {
@@ -911,7 +904,7 @@ describe('ReactDOMSelect', () => {
911
904
) ;
912
905
} ) . toErrorDev ( 'Invalid value for prop `value`' ) ;
913
906
914
- expect ( node . value ) . toBe ( 'A Symbol! ' ) ;
907
+ expect ( node . value ) . toBe ( '' ) ;
915
908
} ) ;
916
909
917
910
it ( 'treats updated Symbol defaultValue as an empty string' , ( ) => {
@@ -937,12 +930,12 @@ describe('ReactDOMSelect', () => {
937
930
</ select > ,
938
931
) ;
939
932
940
- expect ( node . value ) . toBe ( 'A Symbol! ' ) ;
933
+ expect ( node . value ) . toBe ( '' ) ;
941
934
} ) ;
942
935
} ) ;
943
936
944
937
describe ( 'When given a function value' , ( ) => {
945
- it ( 'treats initial function value as missing ' , ( ) => {
938
+ it ( 'treats initial function value as an empty string ' , ( ) => {
946
939
let node ;
947
940
948
941
expect ( ( ) => {
@@ -955,7 +948,7 @@ describe('ReactDOMSelect', () => {
955
948
) ;
956
949
} ) . toErrorDev ( 'Invalid value for prop `value`' ) ;
957
950
958
- expect ( node . value ) . toBe ( 'A function! ' ) ;
951
+ expect ( node . value ) . toBe ( '' ) ;
959
952
} ) ;
960
953
961
954
it ( 'treats initial function defaultValue as an empty string' , ( ) => {
@@ -971,7 +964,7 @@ describe('ReactDOMSelect', () => {
971
964
) ;
972
965
} ) . toErrorDev ( 'Invalid value for prop `value`' ) ;
973
966
974
- expect ( node . value ) . toBe ( 'A function! ' ) ;
967
+ expect ( node . value ) . toBe ( '' ) ;
975
968
} ) ;
976
969
977
970
it ( 'treats updated function value as an empty string' , ( ) => {
@@ -997,7 +990,7 @@ describe('ReactDOMSelect', () => {
997
990
</ select > ,
998
991
) ;
999
992
1000
- expect ( node . value ) . toBe ( 'A function! ' ) ;
993
+ expect ( node . value ) . toBe ( '' ) ;
1001
994
} ) ;
1002
995
1003
996
it ( 'treats updated function defaultValue as an empty string' , ( ) => {
@@ -1023,7 +1016,7 @@ describe('ReactDOMSelect', () => {
1023
1016
</ select > ,
1024
1017
) ;
1025
1018
1026
- expect ( node . value ) . toBe ( 'A function! ' ) ;
1019
+ expect ( node . value ) . toBe ( '' ) ;
1027
1020
} ) ;
1028
1021
} ) ;
1029
1022
0 commit comments