Sha256: 3017eab655e44c52f83af5fcd7b88c1863a2a6a1d48d23ee35005c1d1da38a14

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

//= require workarea/storefront/flow_io/flow_country_picker

(function () {
    'use strict';

    describe('WORKAREA.flowCountryPicker', function () {
        describe('urlLocale', function () {
            it('parses iso_3166_3 in url', function () {
                var url = 'https://example.com/deu/products/small-iron-bag';
                expect(WORKAREA.flowCountryPicker.urlLocale(url)).to.eq("deu");
            });

            it('handles url without iso_3166_3', function () {
                var url = 'https://example.com/products/small-iron-bag';
                expect(_.isUndefined(WORKAREA.flowCountryPicker.urlLocale(url))).to.eq(true);
            });
        });

        describe('redirectUrl', function () {
            it('replaces the country in the url', function () {
                var url = 'https://example.com/products/small-iron-bag';
                expect(WORKAREA.flowCountryPicker.redirectUrl(url, "gbr")).to.eq("https://example.com/gbr/products/small-iron-bag");
            });

            it('injects the country into the url', function () {
                var url = 'https://example.com/deu/products/small-iron-bag';
                expect(WORKAREA.flowCountryPicker.redirectUrl(url, "gbr")).to.eq("https://example.com/gbr/products/small-iron-bag");
            });

            it('works without path', function () {
                var url = 'https://example.com/';
                expect(WORKAREA.flowCountryPicker.redirectUrl(url, "gbr")).to.eq("https://example.com/gbr/");

                url = 'https://example.com';
                expect(WORKAREA.flowCountryPicker.redirectUrl(url, "gbr")).to.eq("https://example.com/gbr");
            });
        });
    });
}());

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 test/javascripts/flow_spec.js