@roblexperu/style 1.0.59 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"sessionId":"c9dc61bf-4ecc-458c-90a4-0004b2c84a8c","pid":32053,"procStart":"Mon Aug 3 02:11:37 2026","acquiredAt":1785723260467}
@@ -0,0 +1,36 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm -v)",
5
+ "Bash(npm config *)",
6
+ "Bash(npm view *)",
7
+ "Bash(echo \"EXIT:$?\")",
8
+ "Bash(npm pack *)",
9
+ "Bash(tar xzf *)",
10
+ "Bash(node -e \"console.log\\(JSON.stringify\\(require\\('./package.json'\\).engines\\)\\); console.log\\(JSON.stringify\\(require\\('./package.json'\\).peerDependencies\\)\\)\")",
11
+ "Bash(npm install *)",
12
+ "Bash(jobs)",
13
+ "Bash(npx --no-install sass --version)",
14
+ "Bash(command -v dart-sass)",
15
+ "Bash(/Users/pakgva/.rbenv/shims/sass *)",
16
+ "Bash(npx jest *)",
17
+ "Bash(node_modules/.bin/jest --version)",
18
+ "Bash(grep -E \"^jest$|^sass$\")",
19
+ "Bash(grep -E \"^jest$\")",
20
+ "Bash(grep -E \"^\\(jest|sass\\)$\")",
21
+ "Bash(node_modules/.bin/sass --version)",
22
+ "Bash(node_modules/.bin/jest)",
23
+ "Bash(npm run *)",
24
+ "Bash(git checkout *)",
25
+ "Bash(git add *)",
26
+ "Bash(git commit -m ' *)",
27
+ "Bash(node -e \"console.log\\(require\\('./package.json'\\).version\\)\")",
28
+ "Bash(node *)",
29
+ "Bash(git commit *)",
30
+ "Bash(git tag *)",
31
+ "Bash(git push *)",
32
+ "Bash(npm whoami *)",
33
+ "Bash(npm publish *)"
34
+ ]
35
+ }
36
+ }
package/CLAUDE.md ADDED
@@ -0,0 +1,52 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## What this is
6
+
7
+ `@roblexperu/style` is a Sass (SCSS) design-system/component-library package for Roblex. It compiles to a single distributable stylesheet (`public/css/roblex-style.css`) that consuming apps import. There is no JS application logic here — this repo is styles, an icon font, and web fonts, published to npm.
8
+
9
+ ## Commands
10
+
11
+ - `npm run build` — compile `src/main.scss` → `public/css/roblex-style.css` (expanded, with source map)
12
+ - `npm run build:prod` — same, but compressed output (used for releases)
13
+ - `npm run build:watch` — compile on change, for local development
14
+ - `npm start` — serve `./public` via `live-server` on port 4444, for visually checking compiled CSS
15
+ - `npm run lint:js` — ESLint over `**/*.js` (only `scripts/version-update.js` and `fonts-icons.js` are JS in this repo; runs automatically on staged JS files via husky pre-commit + lint-staged)
16
+ - `npm run build:icon` — regenerates the icon font from `./svg/*.svg` using `fontello-offline-cli`, then runs `fonts-icons.js` to copy the generated font/CSS into `fonts/`, `public/fonts/RoblexIcons`, and `src/icons/_roblex-icons-codes.scss`. Run this after adding/removing/editing an SVG icon in `./svg/`.
17
+ - `npm run update-version` / `npm run push` — interactive version bump (patch/minor/major/preupdate) via `scripts/version-update.js`, which also commits and tags; `push` then runs `npm publish`. This mutates git history and publishes — don't run without the user asking.
18
+
19
+ There is no test suite in this repo.
20
+
21
+ ## Architecture
22
+
23
+ Everything is assembled from `src/main.scss`, which imports (in order): Bootstrap 4, then design layers under `src/`, each with its own `_index.scss` partial acting as a barrel file:
24
+
25
+ 1. `vars/` — Sass variables and maps: colors (`_colors.scss`, incl. the `$colors-roblex` map), breakpoints, base vars (CDN/font path), flexbox vars. No selectors, just tokens.
26
+ 2. `mixins/` — reusable mixins: flexbox helpers, media-query breakpoints, `@font-face`/font-size helpers.
27
+ 3. `typography/` — font-face declarations for the two brand typefaces (Maax, Publica Sans Round) plus the icon font (`_roblex-icons.scss`) and color-utility classes.
28
+ 4. `atoms/` — smallest reusable UI primitives: buttons, inputs, checkboxes/radios, select, toggle, avatar, divider, rating, progress.
29
+ 5. `organisms/` — composed, higher-level components built from atoms: navbar/header, footer, card, dropdown, steps, modal, snack-bar, sidepanel, trading-calculator, calculate, califications, schedule-notifications.
30
+ 6. `pages/` — page-specific style blocks (accounts, authentication, changes, operations, profile, main).
31
+ 7. `utility/` — utility classes (display, cursor, page-level helpers, sweet-alert overrides).
32
+ 8. `icons/` — imports `_roblex-icons-codes.scss`, the generated icon character-code map (do not hand-edit; regenerate via `npm run build:icon`).
33
+
34
+ When adding a new component partial, create the `_name.scss` file in the appropriate layer (atoms/organisms/pages/utility) and add an `@import` line to that layer's `_index.scss` — nothing is auto-globbed.
35
+
36
+ Z-index conventions are documented as a comment at the bottom of `src/main.scss`:
37
+ - `navbar-header`: 1001
38
+ - `roblex-modal`: 2001
39
+ - `cdk-overlay-container`: 4001
40
+
41
+ ## Icon font pipeline
42
+
43
+ Source icons live as individual SVGs in `./svg/`. `npm run build:icon` runs `fontello-offline-cli` against `./svg/` to produce a webfont bundle in `./webfonts/`, then `fonts-icons.js` copies the results into place:
44
+ - `./fonts` → `./public/fonts/`
45
+ - `./webfonts/font` → `./public/fonts/RoblexIcons`
46
+ - `./webfonts/css/roblex-font-icons-codes.scss` → `src/icons/_roblex-icons-codes.scss`
47
+
48
+ `webfonts/config.json` is the Fontello project config (re-importable at fontello.com). Never hand-edit `src/icons/_roblex-icons-codes.scss` or the contents of `webfonts/font` — they're generated.
49
+
50
+ ## Fonts
51
+
52
+ Two brand typefaces are vendored under `./fonts/` (Maax, PublicaSansRound) and served from `$cdn: 'https://cdn.roblex.pe/fonts'` (see `src/vars/_var.scss`) with a local `$path-fonts: '/assets'` fallback path used in dev.
package/fonts-icons.js CHANGED
@@ -1,15 +1,28 @@
1
1
  const fs = require('fs-extra');
2
2
 
3
+ const FILE_MAP = [
4
+ [ './fonts', './public/fonts/' ],
5
+ [ './webfonts/font', './public/fonts/RoblexIcons' ],
6
+ [ './webfonts/css/roblex-font-icons-codes.scss', './src/icons/_roblex-icons-codes.scss' ]
7
+ ];
8
+
3
9
  // Async/Await:
4
10
  async function copyFiles() {
5
11
  try {
6
- await fs.copy('./fonts', './public/fonts/');
7
- await fs.copy('./webfonts/font', './public/fonts/RoblexIcons');
8
- await fs.copy('./webfonts/css/roblex-font-icons-codes.scss', './src/icons/_roblex-icons-codes.scss');
12
+ for ( const [ src, dest ] of FILE_MAP ) {
13
+ await fs.copy(src, dest);
14
+ }
9
15
  console.log('success janus-fonts-icons!');
10
16
  } catch (err) {
11
17
  console.error(err);
12
18
  }
13
19
  }
14
20
 
15
- copyFiles();
21
+ if ( require.main === module ) {
22
+ copyFiles();
23
+ }
24
+
25
+ module.exports = {
26
+ copyFiles,
27
+ FILE_MAP
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roblexperu/style",
3
- "version": "1.0.59",
3
+ "version": "1.1.0",
4
4
  "description": "package for styles",
5
5
  "scripts": {
6
6
  "build": "sass src/main.scss public/css/roblex-style.css ",
@@ -10,10 +10,14 @@
10
10
  "start": "live-server ./public --cors --port=4444",
11
11
  "update-version": "node scripts/version-update.js",
12
12
  "push": "npm run update-version && npm publish",
13
- "lint:js": "eslint . --ext .js"
13
+ "lint:js": "eslint . --ext .js",
14
+ "test": "jest"
14
15
  },
15
16
  "author": "roblex",
16
17
  "license": "ISC",
18
+ "engines": {
19
+ "node": "^12.20.0 || ^14.15.0 || >=16.10.0"
20
+ },
17
21
  "dependencies": {
18
22
  "bootstrap": "^4.6.0",
19
23
  "live-server": "^1.2.1"
@@ -23,9 +27,11 @@
23
27
  "fontello-offline-cli": "^7.0.0",
24
28
  "fs-extra": "^9.1.0",
25
29
  "husky": "^5.1.3",
30
+ "jest": "^29.7.0",
26
31
  "lint-staged": "^10.5.4",
27
32
  "prompts": "^2.4.0",
28
- "sass": "^1.58.0"
33
+ "sass": ">=1.58.0 <1.83.0",
34
+ "sass-true": "^7.0.0"
29
35
  },
30
36
  "husky": {
31
37
  "hooks": {
@@ -7,67 +7,105 @@ const {
7
7
  } = require('child_process');
8
8
  const chalk = require('chalk');
9
9
 
10
- validateWorkspace();
10
+ function parseVersionString(versionString) {
11
+ const preversion = versionString.split('-');
12
+ const version = preversion[0].split('.');
11
13
 
12
- const preversion = packageJson.version.split('-');
13
- const version = preversion[0].split('.');
14
- const [ p, n, m ] = version;
14
+ if ( version.length !== 3 ) {
15
+ throw new Error('Formato de versión incorrecto');
16
+ }
15
17
 
16
- if ( version.length !== 3 ) {
17
- console.log('Formato de versión incorrecto', err);
18
- process.exit(1);
18
+ return { version, prerelease: preversion[1] };
19
19
  }
20
20
 
21
- let currentVersion = version.join('.');
22
- if ( preversion[1] ) {
23
- currentVersion += `-${ preversion[1] }`;
21
+ function computeNextVersion(versionString, bumpType) {
22
+ const { version, prerelease } = parseVersionString(versionString);
23
+ let [ p, n, m ] = version;
24
+ let nextPrerelease = prerelease;
25
+
26
+ switch (bumpType) {
27
+ case 'patch':
28
+ m = `${ (+m) + 1 }`;
29
+ nextPrerelease = undefined;
30
+ break;
31
+ case 'minor':
32
+ n = `${ (+n) + 1 }`;
33
+ m = '0';
34
+ nextPrerelease = undefined;
35
+ break;
36
+ case 'major':
37
+ p = `${ (+p) + 1 }`;
38
+ n = '0';
39
+ m = '0';
40
+ nextPrerelease = undefined;
41
+ break;
42
+ case 'preupdate':
43
+ nextPrerelease = prerelease !== undefined ? `${ (+prerelease) + 1 }` : '0';
44
+ break;
45
+ default:
46
+ throw new Error(`Tipo de versión desconocido: ${ bumpType }`);
47
+ }
48
+
49
+ const nextVersion = [ p, n, m ].join('.');
50
+ return nextPrerelease !== undefined ? `${ nextVersion }-${ nextPrerelease }` : nextVersion;
24
51
  }
25
52
 
26
- const patch = `${ p }.${ n }.${ chalk.bold.dim.yellowBright(+m + 1) }`;
27
- const minor = `${ p }.${ chalk.bold.dim.yellowBright(+n + 1) }.0`;
28
- const major = `${ chalk.bold.dim.yellowBright(+p + 1) }.0.0`;
29
-
30
- const preUpdate = `${ p }.${ n }.${ m }-${ chalk.bold.dim.yellowBright(+preversion[1] + 1 || 0) }`;
31
-
32
- const question = [ {
33
- type: 'select',
34
- name: 'version',
35
- message: `Seleccione la versión a subir. (Actual: ${ currentVersion })`,
36
- choices: [
37
- {
38
- title: `Patch: ${ patch }`,
39
- value: 'patch'
40
- },
41
- {
42
- title: `Minor: ${ minor }`,
43
- value: 'minor'
44
- },
45
- {
46
- title: `Major: ${ major }`,
47
- value: 'major'
48
- },
49
- {
50
- title: `Preupdate: ${ preUpdate }`,
51
- value: 'preupdate'
52
- }
53
- ]
54
- } ];
53
+ function run() {
55
54
 
56
- (async () => {
55
+ validateWorkspace();
57
56
 
58
- const response = await prompts(question);
57
+ const { version, prerelease } = parseVersionString(packageJson.version);
58
+ const [ p, n, m ] = version;
59
59
 
60
- if ( !response.version ) {
61
- console.log(chalk.red.bold('No se seleccionó ninguna opción'));
62
- process.exit(1);
60
+ let currentVersion = version.join('.');
61
+ if ( prerelease ) {
62
+ currentVersion += `-${ prerelease }`;
63
63
  }
64
64
 
65
- analizeResponse(response);
66
- updatePackageJsonVersion();
67
- writePackageJson();
65
+ const patch = `${ p }.${ n }.${ chalk.bold.dim.yellowBright(+m + 1) }`;
66
+ const minor = `${ p }.${ chalk.bold.dim.yellowBright(+n + 1) }.0`;
67
+ const major = `${ chalk.bold.dim.yellowBright(+p + 1) }.0.0`;
68
+
69
+ const preUpdate = `${ p }.${ n }.${ m }-${ chalk.bold.dim.yellowBright(+prerelease + 1 || 0) }`;
70
+
71
+ const question = [ {
72
+ type: 'select',
73
+ name: 'version',
74
+ message: `Seleccione la versión a subir. (Actual: ${ currentVersion })`,
75
+ choices: [
76
+ {
77
+ title: `Patch: ${ patch }`,
78
+ value: 'patch'
79
+ },
80
+ {
81
+ title: `Minor: ${ minor }`,
82
+ value: 'minor'
83
+ },
84
+ {
85
+ title: `Major: ${ major }`,
86
+ value: 'major'
87
+ },
88
+ {
89
+ title: `Preupdate: ${ preUpdate }`,
90
+ value: 'preupdate'
91
+ }
92
+ ]
93
+ } ];
94
+
95
+ (async () => {
68
96
 
97
+ const response = await prompts(question);
69
98
 
70
- })();
99
+ if ( !response.version ) {
100
+ console.log(chalk.red.bold('No se seleccionó ninguna opción'));
101
+ process.exit(1);
102
+ }
103
+
104
+ packageJson.version = computeNextVersion(packageJson.version, response.version);
105
+ writePackageJson();
106
+
107
+ })();
108
+ }
71
109
 
72
110
  function validateWorkspace() {
73
111
  const workSpace = spawnSync('git', [ 'status', '--porcelain' ]);
@@ -99,13 +137,6 @@ function writePackageJson() {
99
137
  });
100
138
  }
101
139
 
102
- function updatePackageJsonVersion() {
103
- packageJson.version = version.join('.');
104
- if ( preversion[1] ) {
105
- packageJson.version += `-${ preversion[1] }`;
106
- }
107
- }
108
-
109
140
  function gitUpdate() {
110
141
  const addGit = spawnSync('git', [ 'add', '-A' ]);
111
142
  if ( addGit.error ) {
@@ -124,29 +155,11 @@ function gitUpdate() {
124
155
  }
125
156
  }
126
157
 
127
- function analizeResponse(response) {
128
- switch (response.version) {
129
- case 'patch':
130
- version[2] = `${ (+m) + 1 }`;
131
- preversion[1] = undefined;
132
- break;
133
- case 'minor':
134
- version[1] = `${ (+n) + 1 }`;
135
- version[2] = '0';
136
- preversion[1] = undefined;
137
- break;
138
- case 'major':
139
- version[0] = `${ (+p) + 1 }`;
140
- version[1] = '0';
141
- version[2] = '0';
142
- preversion[1] = undefined;
143
- break;
144
- case 'preupdate':
145
- if ( preversion[1] ) {
146
- preversion[1] = (+preversion[1]) + 1;
147
- } else {
148
- preversion[1] = '0';
149
- }
150
- break;
151
- }
158
+ if ( require.main === module ) {
159
+ run();
152
160
  }
161
+
162
+ module.exports = {
163
+ parseVersionString,
164
+ computeNextVersion
165
+ };
@@ -0,0 +1,53 @@
1
+ jest.mock('fs-extra');
2
+
3
+ const fs = require('fs-extra');
4
+ const { copyFiles, FILE_MAP } = require('../../fonts-icons');
5
+
6
+ describe('copyFiles', () => {
7
+ afterEach(() => {
8
+ jest.clearAllMocks();
9
+ });
10
+
11
+ it('copies fonts, the icon webfont, and the generated icon codes scss to their destinations, in order', async () => {
12
+ fs.copy.mockResolvedValue();
13
+
14
+ await copyFiles();
15
+
16
+ expect(fs.copy).toHaveBeenCalledTimes(FILE_MAP.length);
17
+ FILE_MAP.forEach(([ src, dest ], index) => {
18
+ expect(fs.copy).toHaveBeenNthCalledWith(index + 1, src, dest);
19
+ });
20
+ });
21
+
22
+ it('logs a success message once every copy resolves', async () => {
23
+ fs.copy.mockResolvedValue();
24
+ const consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => {});
25
+
26
+ await copyFiles();
27
+
28
+ expect(consoleLogSpy).toHaveBeenCalledWith('success janus-fonts-icons!');
29
+ consoleLogSpy.mockRestore();
30
+ });
31
+
32
+ it('logs the error instead of throwing when a copy fails', async () => {
33
+ const error = new Error('boom');
34
+ fs.copy.mockRejectedValueOnce(error);
35
+ const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
36
+
37
+ await expect(copyFiles()).resolves.toBeUndefined();
38
+
39
+ expect(consoleErrorSpy).toHaveBeenCalledWith(error);
40
+ consoleErrorSpy.mockRestore();
41
+ });
42
+
43
+ it('stops copying the remaining files once one copy fails', async () => {
44
+ fs.copy
45
+ .mockResolvedValueOnce()
46
+ .mockRejectedValueOnce(new Error('boom'));
47
+ jest.spyOn(console, 'error').mockImplementation(() => {});
48
+
49
+ await copyFiles();
50
+
51
+ expect(fs.copy).toHaveBeenCalledTimes(2);
52
+ });
53
+ });
@@ -0,0 +1,49 @@
1
+ const { parseVersionString, computeNextVersion } = require('../../scripts/version-update');
2
+
3
+ describe('parseVersionString', () => {
4
+ it('splits a plain semver string into its numeric parts', () => {
5
+ expect(parseVersionString('1.0.59')).toEqual({
6
+ version: [ '1', '0', '59' ],
7
+ prerelease: undefined
8
+ });
9
+ });
10
+
11
+ it('splits a prerelease version into its numeric parts and prerelease counter', () => {
12
+ expect(parseVersionString('1.0.59-3')).toEqual({
13
+ version: [ '1', '0', '59' ],
14
+ prerelease: '3'
15
+ });
16
+ });
17
+
18
+ it('throws when the version does not have exactly 3 numeric segments', () => {
19
+ expect(() => parseVersionString('1.0')).toThrow('Formato de versión incorrecto');
20
+ });
21
+ });
22
+
23
+ describe('computeNextVersion', () => {
24
+ it('bumps the patch segment and drops any existing prerelease', () => {
25
+ expect(computeNextVersion('1.0.59-3', 'patch')).toBe('1.0.60');
26
+ });
27
+
28
+ it('bumps the minor segment and resets the patch segment to 0', () => {
29
+ expect(computeNextVersion('1.2.59', 'minor')).toBe('1.3.0');
30
+ });
31
+
32
+ it('bumps the major segment and resets minor and patch to 0', () => {
33
+ expect(computeNextVersion('1.2.59', 'major')).toBe('2.0.0');
34
+ });
35
+
36
+ it('starts a prerelease counter at 0 when there is no existing prerelease', () => {
37
+ expect(computeNextVersion('1.0.59', 'preupdate')).toBe('1.0.59-0');
38
+ });
39
+
40
+ it('increments an existing prerelease counter', () => {
41
+ expect(computeNextVersion('1.0.59-3', 'preupdate')).toBe('1.0.59-4');
42
+ });
43
+
44
+ it('throws for an unrecognized bump type', () => {
45
+ expect(() => computeNextVersion('1.0.59', 'unknown')).toThrow(
46
+ 'Tipo de versión desconocido: unknown'
47
+ );
48
+ });
49
+ });
@@ -0,0 +1,4 @@
1
+ const path = require('path');
2
+ const sassTrue = require('sass-true');
3
+
4
+ sassTrue.runSass({ describe, it }, path.join(__dirname, 'flexbox.test.scss'));
@@ -0,0 +1,479 @@
1
+ @import '../../node_modules/sass-true/sass/true';
2
+ @import '../../src/mixins/flexbox';
3
+
4
+ @include describe('flexbox mixin') {
5
+ @include it('sets display to flex with vendor-prefixed fallbacks') {
6
+ @include assert {
7
+ @include output {
8
+ @include flexbox;
9
+ }
10
+
11
+ @include expect {
12
+ display: -webkit-box !important;
13
+ display: -moz-box !important;
14
+ display: -webkit-flex !important;
15
+ display: -ms-flexbox !important;
16
+ display: flex !important;
17
+ }
18
+ }
19
+ }
20
+ }
21
+
22
+ @include describe('inline-flex mixin') {
23
+ @include it('sets display to inline-flex with vendor-prefixed fallbacks') {
24
+ @include assert {
25
+ @include output {
26
+ @include inline-flex;
27
+ }
28
+
29
+ @include expect {
30
+ display: -webkit-inline-box !important;
31
+ display: -moz-inline-box !important;
32
+ display: -webkit-inline-flex !important;
33
+ display: -ms-inline-flexbox !important;
34
+ display: inline-flex !important;
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ @include describe('flex-direction mixin') {
41
+ @include it('defaults to row') {
42
+ @include assert {
43
+ @include output {
44
+ @include flex-direction;
45
+ }
46
+
47
+ @include expect {
48
+ -webkit-box-direction: normal !important;
49
+ -webkit-box-orient: horizontal !important;
50
+ -moz-box-direction: normal !important;
51
+ -moz-box-orient: horizontal !important;
52
+ -webkit-flex-direction: row !important;
53
+ -ms-flex-direction: row !important;
54
+ flex-direction: row !important;
55
+ }
56
+ }
57
+ }
58
+
59
+ @include it('reverses the box direction for row-reverse') {
60
+ @include assert {
61
+ @include output {
62
+ @include flex-direction(row-reverse);
63
+ }
64
+
65
+ @include expect {
66
+ -webkit-box-direction: reverse !important;
67
+ -webkit-box-orient: horizontal !important;
68
+ -moz-box-direction: reverse !important;
69
+ -moz-box-orient: horizontal !important;
70
+ -webkit-flex-direction: row-reverse !important;
71
+ -ms-flex-direction: row-reverse !important;
72
+ flex-direction: row-reverse !important;
73
+ }
74
+ }
75
+ }
76
+
77
+ @include it('switches the box orientation to vertical for column') {
78
+ @include assert {
79
+ @include output {
80
+ @include flex-direction(column);
81
+ }
82
+
83
+ @include expect {
84
+ -webkit-box-direction: normal !important;
85
+ -webkit-box-orient: vertical !important;
86
+ -moz-box-direction: normal !important;
87
+ -moz-box-orient: vertical !important;
88
+ -webkit-flex-direction: column !important;
89
+ -ms-flex-direction: column !important;
90
+ flex-direction: column !important;
91
+ }
92
+ }
93
+ }
94
+
95
+ @include it('reverses the box direction for column-reverse') {
96
+ @include assert {
97
+ @include output {
98
+ @include flex-direction(column-reverse);
99
+ }
100
+
101
+ @include expect {
102
+ -webkit-box-direction: reverse !important;
103
+ -webkit-box-orient: vertical !important;
104
+ -moz-box-direction: reverse !important;
105
+ -moz-box-orient: vertical !important;
106
+ -webkit-flex-direction: column-reverse !important;
107
+ -ms-flex-direction: column-reverse !important;
108
+ flex-direction: column-reverse !important;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ @include describe('flex-wrap mixin') {
115
+ @include it('maps the default nowrap value to -ms-flex-wrap: none') {
116
+ @include assert {
117
+ @include output {
118
+ @include flex-wrap;
119
+ }
120
+
121
+ @include expect {
122
+ -webkit-flex-wrap: nowrap !important;
123
+ -ms-flex-wrap: none !important;
124
+ flex-wrap: nowrap !important;
125
+ }
126
+ }
127
+ }
128
+
129
+ @include it('passes non-nowrap values straight through to -ms-flex-wrap') {
130
+ @include assert {
131
+ @include output {
132
+ @include flex-wrap(wrap);
133
+ }
134
+
135
+ @include expect {
136
+ -webkit-flex-wrap: wrap !important;
137
+ -ms-flex-wrap: wrap !important;
138
+ flex-wrap: wrap !important;
139
+ }
140
+ }
141
+ }
142
+ }
143
+
144
+ @include describe('flex-flow mixin') {
145
+ @include it('defaults to row nowrap') {
146
+ @include assert {
147
+ @include output {
148
+ @include flex-flow;
149
+ }
150
+
151
+ @include expect {
152
+ -webkit-flex-flow: row nowrap !important;
153
+ -ms-flex-flow: row nowrap !important;
154
+ flex-flow: row nowrap !important;
155
+ }
156
+ }
157
+ }
158
+
159
+ @include it('accepts a custom value list') {
160
+ @include assert {
161
+ @include output {
162
+ @include flex-flow(column wrap);
163
+ }
164
+
165
+ @include expect {
166
+ -webkit-flex-flow: column wrap !important;
167
+ -ms-flex-flow: column wrap !important;
168
+ flex-flow: column wrap !important;
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ @include describe('order mixin') {
175
+ @include it('defaults to 0, offsetting the box-ordinal-group properties by 1') {
176
+ @include assert {
177
+ @include output {
178
+ @include order;
179
+ }
180
+
181
+ @include expect {
182
+ -webkit-box-ordinal-group: 1 !important;
183
+ -moz-box-ordinal-group: 1 !important;
184
+ -webkit-order: 0 !important;
185
+ -ms-flex-order: 0 !important;
186
+ order: 0 !important;
187
+ }
188
+ }
189
+ }
190
+
191
+ @include it('offsets a custom order by 1 for the box-ordinal-group properties') {
192
+ @include assert {
193
+ @include output {
194
+ @include order(2);
195
+ }
196
+
197
+ @include expect {
198
+ -webkit-box-ordinal-group: 3 !important;
199
+ -moz-box-ordinal-group: 3 !important;
200
+ -webkit-order: 2 !important;
201
+ -ms-flex-order: 2 !important;
202
+ order: 2 !important;
203
+ }
204
+ }
205
+ }
206
+ }
207
+
208
+ @include describe('flex-grow mixin') {
209
+ @include it('defaults to 1') {
210
+ @include assert {
211
+ @include output {
212
+ @include flex-grow;
213
+ }
214
+
215
+ @include expect {
216
+ -webkit-box-flex: 1 !important;
217
+ -moz-box-flex: 1 !important;
218
+ -webkit-flex-grow: 1 !important;
219
+ -ms-flex-positive: 1 !important;
220
+ flex-grow: 1 !important;
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ @include describe('flex-shrink mixin') {
227
+ @include it('defaults to 0') {
228
+ @include assert {
229
+ @include output {
230
+ @include flex-shrink;
231
+ }
232
+
233
+ @include expect {
234
+ -webkit-flex-shrink: 0 !important;
235
+ -moz-flex-shrink: 0 !important;
236
+ -ms-flex: 0 !important;
237
+ flex-shrink: 0 !important;
238
+ }
239
+ }
240
+ }
241
+ }
242
+
243
+ @include describe('flex-basis mixin') {
244
+ @include it('defaults to auto') {
245
+ @include assert {
246
+ @include output {
247
+ @include flex-basis;
248
+ }
249
+
250
+ @include expect {
251
+ -ms-flex-preferred-size: auto !important;
252
+ -webkit-flex-basis: auto !important;
253
+ flex-basis: auto !important;
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ @include describe('flex mixin') {
260
+ @include it('defaults to grow:1 shrink:0 basis:auto') {
261
+ @include assert {
262
+ @include output {
263
+ @include flex;
264
+ }
265
+
266
+ @include expect {
267
+ -webkit-box: 1 !important;
268
+ -moz-box: 1 !important;
269
+ -webkit-flex: 1 0 auto !important;
270
+ -ms-flex: 1 0 auto !important;
271
+ flex: 1 0 auto !important;
272
+ }
273
+ }
274
+ }
275
+
276
+ @include it('uses the flex shorthand property alone when basis is initial') {
277
+ @include assert {
278
+ @include output {
279
+ @include flex(1, 0, initial);
280
+ }
281
+
282
+ @include expect {
283
+ -webkit-flex: initial !important;
284
+ -ms-flex: initial !important;
285
+ flex: initial !important;
286
+ }
287
+ }
288
+ }
289
+ }
290
+
291
+ @include describe('justify-content mixin') {
292
+ @include it('maps flex-start to box-pack: start') {
293
+ @include assert {
294
+ @include output {
295
+ @include justify-content(flex-start);
296
+ }
297
+
298
+ @include expect {
299
+ -webkit-box-pack: start !important;
300
+ -moz-box-pack: start !important;
301
+ -ms-flex-pack: start !important;
302
+ -webkit-justify-content: flex-start !important;
303
+ justify-content: flex-start !important;
304
+ }
305
+ }
306
+ }
307
+
308
+ @include it('maps flex-end to box-pack: end') {
309
+ @include assert {
310
+ @include output {
311
+ @include justify-content(flex-end);
312
+ }
313
+
314
+ @include expect {
315
+ -webkit-box-pack: end !important;
316
+ -moz-box-pack: end !important;
317
+ -ms-flex-pack: end !important;
318
+ -webkit-justify-content: flex-end !important;
319
+ justify-content: flex-end !important;
320
+ }
321
+ }
322
+ }
323
+
324
+ @include it('maps space-between to box-pack: justify') {
325
+ @include assert {
326
+ @include output {
327
+ @include justify-content(space-between);
328
+ }
329
+
330
+ @include expect {
331
+ -webkit-box-pack: justify !important;
332
+ -moz-box-pack: justify !important;
333
+ -ms-flex-pack: justify !important;
334
+ -webkit-justify-content: space-between !important;
335
+ justify-content: space-between !important;
336
+ }
337
+ }
338
+ }
339
+
340
+ @include it('maps space-around to -ms-flex-pack: distribute, without a box-pack fallback') {
341
+ @include assert {
342
+ @include output {
343
+ @include justify-content(space-around);
344
+ }
345
+
346
+ @include expect {
347
+ -ms-flex-pack: distribute !important;
348
+ -webkit-justify-content: space-around !important;
349
+ justify-content: space-around !important;
350
+ }
351
+ }
352
+ }
353
+
354
+ @include it('passes other values straight through to box-pack') {
355
+ @include assert {
356
+ @include output {
357
+ @include justify-content(center);
358
+ }
359
+
360
+ @include expect {
361
+ -webkit-box-pack: center !important;
362
+ -moz-box-pack: center !important;
363
+ -ms-flex-pack: center !important;
364
+ -webkit-justify-content: center !important;
365
+ justify-content: center !important;
366
+ }
367
+ }
368
+ }
369
+ }
370
+
371
+ @include describe('align-items mixin') {
372
+ @include it('defaults to stretch') {
373
+ @include assert {
374
+ @include output {
375
+ @include align-items;
376
+ }
377
+
378
+ @include expect {
379
+ -webkit-box-align: stretch !important;
380
+ -moz-box-align: stretch !important;
381
+ -ms-flex-align: stretch !important;
382
+ -webkit-align-items: stretch !important;
383
+ align-items: stretch !important;
384
+ }
385
+ }
386
+ }
387
+
388
+ @include it('maps flex-start to box-align: start') {
389
+ @include assert {
390
+ @include output {
391
+ @include align-items(flex-start);
392
+ }
393
+
394
+ @include expect {
395
+ -webkit-box-align: start !important;
396
+ -moz-box-align: start !important;
397
+ -ms-flex-align: start !important;
398
+ -webkit-align-items: flex-start !important;
399
+ align-items: flex-start !important;
400
+ }
401
+ }
402
+ }
403
+
404
+ @include it('maps flex-end to box-align: end') {
405
+ @include assert {
406
+ @include output {
407
+ @include align-items(flex-end);
408
+ }
409
+
410
+ @include expect {
411
+ -webkit-box-align: end !important;
412
+ -moz-box-align: end !important;
413
+ -ms-flex-align: end !important;
414
+ -webkit-align-items: flex-end !important;
415
+ align-items: flex-end !important;
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ @include describe('align-self mixin') {
422
+ @include it('defaults to auto') {
423
+ @include assert {
424
+ @include output {
425
+ @include align-self;
426
+ }
427
+
428
+ @include expect {
429
+ -webkit-align-self: auto !important;
430
+ -ms-flex-item-align: auto !important;
431
+ align-self: auto !important;
432
+ }
433
+ }
434
+ }
435
+
436
+ @include it('maps flex-end to -ms-flex-item-align: end') {
437
+ @include assert {
438
+ @include output {
439
+ @include align-self(flex-end);
440
+ }
441
+
442
+ @include expect {
443
+ -webkit-align-self: flex-end !important;
444
+ -ms-flex-item-align: end !important;
445
+ align-self: flex-end !important;
446
+ }
447
+ }
448
+ }
449
+ }
450
+
451
+ @include describe('align-content mixin') {
452
+ @include it('defaults to stretch') {
453
+ @include assert {
454
+ @include output {
455
+ @include align-content;
456
+ }
457
+
458
+ @include expect {
459
+ -webkit-align-content: stretch !important;
460
+ -ms-flex-line-pack: stretch !important;
461
+ align-content: stretch !important;
462
+ }
463
+ }
464
+ }
465
+
466
+ @include it('maps flex-start to -ms-flex-line-pack: start') {
467
+ @include assert {
468
+ @include output {
469
+ @include align-content(flex-start);
470
+ }
471
+
472
+ @include expect {
473
+ -webkit-align-content: flex-start !important;
474
+ -ms-flex-line-pack: start !important;
475
+ align-content: flex-start !important;
476
+ }
477
+ }
478
+ }
479
+ }
@@ -0,0 +1,4 @@
1
+ const path = require('path');
2
+ const sassTrue = require('sass-true');
3
+
4
+ sassTrue.runSass({ describe, it }, path.join(__dirname, 'fonts.test.scss'));
@@ -0,0 +1,243 @@
1
+ @import '../../node_modules/sass-true/sass/true';
2
+ @import '../../src/vars/breakpoint';
3
+ @import '../../src/mixins/media';
4
+ @import '../../src/mixins/fonts';
5
+
6
+ @include describe('font-face mixin') {
7
+ @include it('emits a single @font-face rule with an EOT primary src and a full-format src fallback list') {
8
+ @include assert {
9
+ @include output {
10
+ @include font-face('https://cdn.example.com', 'Maax-Bold', 'Maax', 'Maax-Bold');
11
+ }
12
+
13
+ @include expect {
14
+ @font-face {
15
+ font-family: "Maax-Bold";
16
+ src: url("https://cdn.example.com/fonts/Maax/Maax-Bold.eot");
17
+ src: url("https://cdn.example.com/fonts/Maax/Maax-Bold.eot?#iefix") format("embedded-opentype"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.svg") format("svg"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.ttf") format("truetype"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.woff") format("woff"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.woff2") format("woff2");
18
+ font-weight: normal;
19
+ font-style: normal;
20
+ font-display: swap;
21
+ }
22
+ }
23
+ }
24
+ }
25
+
26
+ @include it('accepts a custom weight and style') {
27
+ @include assert {
28
+ @include output {
29
+ @include font-face('https://cdn.example.com', 'Maax-Bold', 'Maax', 'Maax-Bold', bold, italic);
30
+ }
31
+
32
+ @include expect {
33
+ @font-face {
34
+ font-family: "Maax-Bold";
35
+ src: url("https://cdn.example.com/fonts/Maax/Maax-Bold.eot");
36
+ src: url("https://cdn.example.com/fonts/Maax/Maax-Bold.eot?#iefix") format("embedded-opentype"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.svg") format("svg"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.ttf") format("truetype"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.woff") format("woff"), url("https://cdn.example.com/fonts/Maax/Maax-Bold.woff2") format("woff2");
37
+ font-weight: bold;
38
+ font-style: italic;
39
+ font-display: swap;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ @include describe('font-face-for-fonts mixin') {
47
+ $test-fonts: (
48
+ Maax: (),
49
+ Maax-Bold: (
50
+ name: 'Maax Bold Family',
51
+ weight: bold,
52
+ style: italic
53
+ )
54
+ );
55
+
56
+ @include it('emits one @font-face per font, defaulting the family name to the map key and weight/style to normal') {
57
+ @include assert {
58
+ @include output {
59
+ @include font-face-for-fonts('/assets', 'Maax', $test-fonts);
60
+ }
61
+
62
+ @include expect {
63
+ @font-face {
64
+ font-family: "Maax";
65
+ src: url("/assets/fonts/Maax/Maax.eot");
66
+ src: url("/assets/fonts/Maax/Maax.eot?#iefix") format("embedded-opentype"), url("/assets/fonts/Maax/Maax.svg") format("svg"), url("/assets/fonts/Maax/Maax.ttf") format("truetype"), url("/assets/fonts/Maax/Maax.woff") format("woff"), url("/assets/fonts/Maax/Maax.woff2") format("woff2");
67
+ font-weight: normal;
68
+ font-style: normal;
69
+ font-display: swap;
70
+ }
71
+
72
+ @font-face {
73
+ font-family: "Maax Bold Family";
74
+ src: url("/assets/fonts/Maax/Maax-Bold.eot");
75
+ src: url("/assets/fonts/Maax/Maax-Bold.eot?#iefix") format("embedded-opentype"), url("/assets/fonts/Maax/Maax-Bold.svg") format("svg"), url("/assets/fonts/Maax/Maax-Bold.ttf") format("truetype"), url("/assets/fonts/Maax/Maax-Bold.woff") format("woff"), url("/assets/fonts/Maax/Maax-Bold.woff2") format("woff2");
76
+ font-weight: bold;
77
+ font-style: italic;
78
+ font-display: swap;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ @include describe('font-family-size mixin') {
86
+ $size: (
87
+ size: 18px
88
+ );
89
+
90
+ @include it('builds an unprefixed class selector from font-name, description, and size-attribute') {
91
+ @include assert {
92
+ @include output {
93
+ @include font-family-size('Publica Sans Round', 'Bold', $size, 'publica-sans-round', 'bold', 'text-sm', bold);
94
+ }
95
+
96
+ @include expect {
97
+ .publica-sans-round-bold-text-sm {
98
+ font-family: "Publica Sans Round";
99
+ font-size: 18px;
100
+ font-weight: bold;
101
+ font-style: normal;
102
+ line-height: normal;
103
+ letter-spacing: normal;
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ @include it('prefixes the class with the breakpoint and appends the type suffix to font-size when given') {
110
+ @include assert {
111
+ @include output {
112
+ @include font-family-size('Publica Sans Round', 'Bold', $size, 'publica-sans-round', 'bold', 'text-sm', bold, normal, 'xs', !important);
113
+ }
114
+
115
+ @include expect {
116
+ .xs-publica-sans-round-bold-text-sm {
117
+ font-family: "Publica Sans Round";
118
+ font-size: 18px !important;
119
+ font-weight: bold;
120
+ font-style: normal;
121
+ line-height: normal;
122
+ letter-spacing: normal;
123
+ }
124
+ }
125
+ }
126
+ }
127
+
128
+ @include it('reads line-height and letter-spacing from the size map when present') {
129
+ $size-with-metrics: (
130
+ size: 18px,
131
+ line: 24px,
132
+ spacing: 0.5px
133
+ );
134
+
135
+ @include assert {
136
+ @include output {
137
+ @include font-family-size('Publica Sans Round', 'Bold', $size-with-metrics, 'publica-sans-round', 'bold', 'text-sm', bold);
138
+ }
139
+
140
+ @include expect {
141
+ .publica-sans-round-bold-text-sm {
142
+ font-family: "Publica Sans Round";
143
+ font-size: 18px;
144
+ font-weight: bold;
145
+ font-style: normal;
146
+ line-height: 24px;
147
+ letter-spacing: 0.5px;
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ @include describe('font-sizing mixin') {
155
+ $test-fonts: (
156
+ Bold: (
157
+ name: 'Publica Sans Round',
158
+ description: 'bold',
159
+ weight: bold,
160
+ style: normal
161
+ )
162
+ );
163
+
164
+ $test-sizing: (
165
+ text-sm: (
166
+ size: 18px
167
+ )
168
+ );
169
+
170
+ @include it('emits an unprefixed class plus a breakpoint-prefixed !important variant for every registered breakpoint') {
171
+ @include assert {
172
+ @include output {
173
+ @include font-sizing('publica-sans-round', $test-sizing, $test-fonts);
174
+ }
175
+
176
+ @include expect {
177
+ .publica-sans-round-bold-text-sm {
178
+ font-family: "Publica Sans Round";
179
+ font-size: 18px;
180
+ font-weight: bold;
181
+ font-style: normal;
182
+ line-height: normal;
183
+ letter-spacing: normal;
184
+ }
185
+
186
+ @media only screen and (max-width: 480px) {
187
+ .xs-publica-sans-round-bold-text-sm {
188
+ font-family: "Publica Sans Round";
189
+ font-size: 18px !important;
190
+ font-weight: bold;
191
+ font-style: normal;
192
+ line-height: normal;
193
+ letter-spacing: normal;
194
+ }
195
+ }
196
+
197
+ @media only screen and (max-width: 776px) {
198
+ .sm-publica-sans-round-bold-text-sm {
199
+ font-family: "Publica Sans Round";
200
+ font-size: 18px !important;
201
+ font-weight: bold;
202
+ font-style: normal;
203
+ line-height: normal;
204
+ letter-spacing: normal;
205
+ }
206
+ }
207
+
208
+ @media only screen and (max-width: 768px) {
209
+ .md-publica-sans-round-bold-text-sm {
210
+ font-family: "Publica Sans Round";
211
+ font-size: 18px !important;
212
+ font-weight: bold;
213
+ font-style: normal;
214
+ line-height: normal;
215
+ letter-spacing: normal;
216
+ }
217
+ }
218
+
219
+ @media only screen and (max-width: 992px) {
220
+ .lg-publica-sans-round-bold-text-sm {
221
+ font-family: "Publica Sans Round";
222
+ font-size: 18px !important;
223
+ font-weight: bold;
224
+ font-style: normal;
225
+ line-height: normal;
226
+ letter-spacing: normal;
227
+ }
228
+ }
229
+
230
+ @media only screen and (max-width: 1300px) {
231
+ .xl-publica-sans-round-bold-text-sm {
232
+ font-family: "Publica Sans Round";
233
+ font-size: 18px !important;
234
+ font-weight: bold;
235
+ font-style: normal;
236
+ line-height: normal;
237
+ letter-spacing: normal;
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+ }
@@ -0,0 +1,4 @@
1
+ const path = require('path');
2
+ const sassTrue = require('sass-true');
3
+
4
+ sassTrue.runSass({ describe, it }, path.join(__dirname, 'media.test.scss'));
@@ -0,0 +1,103 @@
1
+ @import '../../node_modules/sass-true/sass/true';
2
+ @import '../../src/vars/breakpoint';
3
+ @import '../../src/mixins/media';
4
+
5
+ @include describe('breakpoint mixins') {
6
+ @include it('xs wraps content in a max-width media query using $xs') {
7
+ @include assert {
8
+ @include output {
9
+ @include xs {
10
+ color: red;
11
+ }
12
+ }
13
+
14
+ @include expect {
15
+ @media only screen and (max-width: 480px) {
16
+ color: red;
17
+ }
18
+ }
19
+ }
20
+ }
21
+
22
+ @include it('sm wraps content in a max-width media query using $sm') {
23
+ @include assert {
24
+ @include output {
25
+ @include sm {
26
+ color: red;
27
+ }
28
+ }
29
+
30
+ @include expect {
31
+ @media only screen and (max-width: 776px) {
32
+ color: red;
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ @include it('md wraps content in a max-width media query using $md') {
39
+ @include assert {
40
+ @include output {
41
+ @include md {
42
+ color: red;
43
+ }
44
+ }
45
+
46
+ @include expect {
47
+ @media only screen and (max-width: 768px) {
48
+ color: red;
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ @include it('lg wraps content in a max-width media query using $lg') {
55
+ @include assert {
56
+ @include output {
57
+ @include lg {
58
+ color: red;
59
+ }
60
+ }
61
+
62
+ @include expect {
63
+ @media only screen and (max-width: 992px) {
64
+ color: red;
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ @include it('xl wraps content in a max-width media query using $xl') {
71
+ @include assert {
72
+ @include output {
73
+ @include xl {
74
+ color: red;
75
+ }
76
+ }
77
+
78
+ @include expect {
79
+ @media only screen and (max-width: 1300px) {
80
+ color: red;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ @include describe('media-breakpoint mixin') {
88
+ @include it('wraps content in a max-width media query using the given value') {
89
+ @include assert {
90
+ @include output {
91
+ @include media-breakpoint(600px) {
92
+ color: blue;
93
+ }
94
+ }
95
+
96
+ @include expect {
97
+ @media only screen and (max-width: 600px) {
98
+ color: blue;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }