diff --git a/client/lib/cart-values/index.js b/client/lib/cart-values/index.js index 439318704a0e3..ae2d907828daa 100644 --- a/client/lib/cart-values/index.js +++ b/client/lib/cart-values/index.js @@ -17,7 +17,7 @@ import { hasDomainRegistration, hasPlan, } from './cart-items'; -import { isCredits, isDomainRedemption, whitelistAttributes } from 'lib/products-values'; +import { isCredits, isDomainRedemption, allowedProductAttributes } from 'lib/products-values'; import { detectWebPaymentMethod } from 'lib/web-payment'; // Auto-vivification from https://github.com/kolodny/immutability-helper#autovivification @@ -268,7 +268,7 @@ export function fillInAllCartItemAttributes( cart, products ) { export function fillInSingleCartItemAttributes( cartItem, products ) { const product = products[ cartItem.product_slug ]; - const attributes = whitelistAttributes( product ); + const attributes = allowedProductAttributes( product ); return extend( {}, cartItem, attributes ); } diff --git a/client/lib/cart/actions.js b/client/lib/cart/actions.js index cb35851c8d05d..dcfc4169a4a95 100644 --- a/client/lib/cart/actions.js +++ b/client/lib/cart/actions.js @@ -126,7 +126,7 @@ export function getRememberedCoupon() { debug( 'No coupons found in localStorage: ', coupons ); return null; } - const COUPON_CODE_WHITELIST = [ + const ALLOWED_COUPON_CODE_LIST = [ 'ALT', 'FBSAVE15', 'FIVERR', @@ -160,7 +160,7 @@ export function getRememberedCoupon() { debug( 'Storing coupons in localStorage: ', coupons ); window.localStorage.setItem( MARKETING_COUPONS_KEY, JSON.stringify( coupons ) ); if ( - COUPON_CODE_WHITELIST.includes( + ALLOWED_COUPON_CODE_LIST.includes( -1 !== mostRecentCouponCode.indexOf( '_' ) ? mostRecentCouponCode.substring( 0, mostRecentCouponCode.indexOf( '_' ) ) : mostRecentCouponCode diff --git a/client/lib/plugins/test/sanitize-section-content.js b/client/lib/plugins/test/sanitize-section-content.js index 52d4a4b86361c..eca901302c9a5 100644 --- a/client/lib/plugins/test/sanitize-section-content.js +++ b/client/lib/plugins/test/sanitize-section-content.js @@ -11,7 +11,7 @@ import { sanitizeSectionContent as clean } from '../sanitize-section-content'; * Attempts to create a DOM node from given HTML * * @param {string} html expected HTML to create node - * @returns {Node | null} possible node described by HTML + * @returns {object | null} possible node described by HTML */ const cleanNode = ( html ) => { const div = document.createElement( 'div' ); @@ -21,30 +21,30 @@ const cleanNode = ( html ) => { return div.firstChild; }; -test( 'should allow whitelisted tags', () => +test( 'should not strip allowed tags', () => expect( clean( '
👍
' ) ).toBe( '
👍
' ) ); -test( 'should strip out non-whitelisted tags', () => +test( 'should strip out disallowed tags', () => expect( clean( '' ) ).toBe( '' ) ); test( 'should preserve children of stripped tags', () => expect( clean( '👍' ) ).toBe( '👍' ) ); -test( 'should strip out content with non-whitelisted tags', () => +test( 'should strip out content with disallowed tags', () => expect( clean( '

👍

' ) ).toBe( '

alert("do bad things")👍

' ) ); -test( 'should strip out non-whitelisted children', () => +test( 'should strip out disallowed children', () => expect( clean( '👍' ) ).toBe( '👍' ) ); test( 'should not break when no attributes present', () => expect( clean( '

' ) ).toBe( '

' ) ); -test( 'should allow whitelisted attributes', () => +test( 'should not strip allowed attributes', () => expect( clean( 'graphic' ) ).toBe( 'graphic' ) ); -test( 'should strip out non-whitelisted attributes', () => +test( 'should strip out disallowed attributes', () => expect( clean( '👍' ) ).toBe( '👍' ) ); test( 'should allow http(s) links', () => { @@ -105,7 +105,7 @@ test( 'should strip out ' * which leads to unexpected `