WordPress.org

Make WordPress Core

Changeset 28225


Ignore:
Timestamp:
05/01/2014 04:15:26 AM (8 years ago)
Author:
nacin
Message:

Customizer: Allow to skip cropping header images if image width is smaller than or equal to theme width.

Merges [28219] to the 3.9 branch.

fixes #27936.

Location:
branches/3.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.9

  • branches/3.9/src/wp-includes/js/customize-models.js

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

    r27847 r28225  
    104104            imageHeight: 8600
    105105        });
     106
     107        equal(this.model.shouldBeCropped(), false);
     108    });
     109
     110    test('should not be cropped when the image width is smaller than or equal to theme width', function() {
     111        this.model.set({
     112            themeFlexWidth: false,
     113            themeFlexHeight: false,
     114            imageWidth: 1000,
     115            imageHeight: 100
     116        });
     117
     118        equal(this.model.shouldBeCropped(), false);
     119    });
     120
     121    test('should not be cropped when the image width is smaller than or equal to 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
    106129        equal(this.model.shouldBeCropped(), false);
    107130    });
Note: See TracChangeset for help on using the changeset viewer.