@@ -239,6 +239,27 @@ describe('attachments', () => {
239239 strictEqual ( state . getIn ( [ 'attachments' , 'a' ] ) . originalValue , 'apiVersion: v1' ) ;
240240 } ) ;
241241
242+ it ( 'AttachmentSet revert clears changed state when originalValue equals value' , ( ) => {
243+ let state = initState ( ) ;
244+ state = dispatch ( state , ActionType . AttachmentSet , {
245+ ...attachment ,
246+ id : 'a' ,
247+ value : 'edited yaml' ,
248+ originalValue : 'apiVersion: v1' ,
249+ } ) ;
250+ strictEqual ( state . getIn ( [ 'attachments' , 'a' ] ) . value , 'edited yaml' ) ;
251+ strictEqual ( state . getIn ( [ 'attachments' , 'a' ] ) . originalValue , 'apiVersion: v1' ) ;
252+
253+ state = dispatch ( state , ActionType . AttachmentSet , {
254+ ...attachment ,
255+ id : 'a' ,
256+ value : 'apiVersion: v1' ,
257+ originalValue : 'apiVersion: v1' ,
258+ } ) ;
259+ strictEqual ( state . getIn ( [ 'attachments' , 'a' ] ) . value , 'apiVersion: v1' ) ;
260+ strictEqual ( state . getIn ( [ 'attachments' , 'a' ] ) . originalValue , 'apiVersion: v1' ) ;
261+ } ) ;
262+
242263 it ( 'AttachmentSet respects empty-string originalValue as explicit' , ( ) => {
243264 let state = initState ( ) ;
244265 state = dispatch ( state , ActionType . AttachmentSet , {
0 commit comments