Make WordPress Core

Ticket #27936: 27936.2.patch

File 27936.2.patch, 1.3 KB (added by ocean90, 11 years ago)
  • src/wp-includes/js/customize-models.js

     
    113113                                return false;
    114114                        }
    115115
     116                        if (this.get('imageWidth') <= this.get('themeWidth')) {
     117                                return false;
     118                        }
     119
    116120                        return true;
    117121                }
    118122        });
  • tests/qunit/wp-admin/js/customize-header.js

     
    103103                        imageWidth: 10000,
    104104                        imageHeight: 8600
    105105                });
     106
    106107                equal(this.model.shouldBeCropped(), false);
    107108        });
     109
     110        test('should not be cropped when the image width is smaller or equal as theme width', function() {
     111                this.model.set({
     112                        themeFlexWidth: false,
     113                        themeFlexHeight: false,
     114                        imageWidth: 1000,
     115                        imageHeight: 100
    108116});
     117
     118                equal(this.model.shouldBeCropped(), false);
     119        });
     120
     121        test('should not be cropped when the image width is smaller or equal as theme width, theme supports flex height and width', function() {
     122                this.model.set({
     123                        themeFlexWidth: true,
     124                        themeFlexHeight: true,
     125                        imageWidth: 900,
     126                        imageHeight: 100
     127                });
     128
     129                equal(this.model.shouldBeCropped(), false);
     130        });
     131});