@@ -19,6 +19,8 @@ function setup(file=staticfile) {
1919 filename : component . find ( '.filename' ) ,
2020 image : component . find ( 'img' ) ,
2121 div : component . find ( '.file-preview a div' ) ,
22+ indicator : component . find ( '.file-preview .theme-indicator' ) ,
23+ delete_btn : component . find ( '.file-preview .delete' ) ,
2224 actions : actions
2325 } ;
2426}
@@ -29,9 +31,20 @@ describe('Components::FilePreview', () => {
2931 expect ( image . node ) . toBeTruthy ( ) ;
3032 expect ( div . node ) . toBeFalsy ( ) ;
3133 } ) ;
34+
3235 it ( 'should render a div if the file does not have an image extension' , ( ) => {
3336 const { image, div } = setup ( { ...staticfile , extname : 'html' } ) ;
3437 expect ( image . node ) . toBeFalsy ( ) ;
3538 expect ( div . node ) . toBeTruthy ( ) ;
3639 } ) ;
40+
41+ it ( 'should render an indicator if file is from theme-gem' , ( ) => {
42+ const { indicator } = setup ( { ...staticfile , from_theme : true } ) ;
43+ expect ( indicator . node ) . toBeTruthy ( ) ;
44+ } ) ;
45+
46+ it ( 'should not render a delete-button if file is from theme-gem' , ( ) => {
47+ const { delete_btn } = setup ( { ...staticfile , from_theme : true } ) ;
48+ expect ( delete_btn . node ) . toBeFalsy ( ) ;
49+ } ) ;
3750} ) ;
0 commit comments