diff --git a/tests/dummy/app/controllers/catalog.js b/tests/dummy/app/controllers/catalog.js new file mode 100644 index 000000000..235bad15e --- /dev/null +++ b/tests/dummy/app/controllers/catalog.js @@ -0,0 +1,602 @@ +import Controller from '@ember/controller'; +import { A } from '@ember/array'; +import { action } from '@ember/object'; +import { later, cancel } from '@ember/runloop'; +import { inject as service } from '@ember/service'; +import { faker } from '@faker-js/faker'; +import { tracked } from '@glimmer/tracking'; +import { buildGridModel } from '../utils/grid-list'; + +export default class CatalogController extends Controller { + // Autocomplete + countries = A([ + { name: 'Afghanistan', code: 'AF' }, + { name: 'Åland Islands', code: 'AX' }, + { name: 'Albania', code: 'AL' }, + { name: 'Algeria', code: 'DZ' }, + { name: 'American Samoa', code: 'AS' }, + { name: 'AndorrA', code: 'AD' }, + { name: 'Angola', code: 'AO' }, + { name: 'Anguilla', code: 'AI' }, + { name: 'Antarctica', code: 'AQ' }, + { name: 'Antigua and Barbuda', code: 'AG' }, + { name: 'Argentina', code: 'AR' }, + { name: 'Armenia', code: 'AM' }, + { name: 'Aruba', code: 'AW' }, + { name: 'Australia', code: 'AU' }, + { name: 'Austria', code: 'AT' }, + { name: 'Azerbaijan', code: 'AZ' }, + { name: 'Bahamas', code: 'BS' }, + { name: 'Bahrain', code: 'BH' }, + { name: 'Bangladesh', code: 'BD' }, + { name: 'Barbados', code: 'BB' }, + { name: 'Belarus', code: 'BY' }, + { name: 'Belgium', code: 'BE' }, + { name: 'Belize', code: 'BZ' }, + { name: 'Benin', code: 'BJ' }, + { name: 'Bermuda', code: 'BM' }, + { name: 'Bhutan', code: 'BT' }, + { name: 'Bolivia', code: 'BO' }, + { name: 'Bosnia and Herzegovina', code: 'BA' }, + { name: 'Botswana', code: 'BW' }, + { name: 'Bouvet Island', code: 'BV' }, + { name: 'Brazil', code: 'BR' }, + { name: 'British Indian Ocean Territory', code: 'IO' }, + { name: 'Brunei Darussalam', code: 'BN' }, + { name: 'Bulgaria', code: 'BG' }, + { name: 'Burkina Faso', code: 'BF' }, + { name: 'Burundi', code: 'BI' }, + { name: 'Cambodia', code: 'KH' }, + { name: 'Cameroon', code: 'CM' }, + { name: 'Canada', code: 'CA' }, + { name: 'Cape Verde', code: 'CV' }, + { name: 'Cayman Islands', code: 'KY' }, + { name: 'Central African Republic', code: 'CF' }, + { name: 'Chad', code: 'TD' }, + { name: 'Chile', code: 'CL' }, + { name: 'China', code: 'CN' }, + { name: 'Christmas Island', code: 'CX' }, + { name: 'Cocos (Keeling) Islands', code: 'CC' }, + { name: 'Colombia', code: 'CO' }, + { name: 'Comoros', code: 'KM' }, + { name: 'Congo', code: 'CG' }, + { name: 'Congo, The Democratic Republic of the', code: 'CD' }, + { name: 'Cook Islands', code: 'CK' }, + { name: 'Costa Rica', code: 'CR' }, + { name: "Cote D'Ivoire", code: 'CI' }, + { name: 'Croatia', code: 'HR' }, + { name: 'Cuba', code: 'CU' }, + { name: 'Cyprus', code: 'CY' }, + { name: 'Czech Republic', code: 'CZ' }, + { name: 'Denmark', code: 'DK' }, + { name: 'Djibouti', code: 'DJ' }, + { name: 'Dominica', code: 'DM' }, + { name: 'Dominican Republic', code: 'DO' }, + { name: 'Ecuador', code: 'EC' }, + { name: 'Egypt', code: 'EG' }, + { name: 'El Salvador', code: 'SV' }, + { name: 'Equatorial Guinea', code: 'GQ' }, + { name: 'Eritrea', code: 'ER' }, + { name: 'Estonia', code: 'EE' }, + { name: 'Ethiopia', code: 'ET' }, + { name: 'Falkland Islands (Malvinas)', code: 'FK' }, + { name: 'Faroe Islands', code: 'FO' }, + { name: 'Fiji', code: 'FJ' }, + { name: 'Finland', code: 'FI' }, + { name: 'France', code: 'FR' }, + { name: 'French Guiana', code: 'GF' }, + { name: 'French Polynesia', code: 'PF' }, + { name: 'French Southern Territories', code: 'TF' }, + { name: 'Gabon', code: 'GA' }, + { name: 'Gambia', code: 'GM' }, + { name: 'Georgia', code: 'GE' }, + { name: 'Germany', code: 'DE' }, + { name: 'Ghana', code: 'GH' }, + { name: 'Gibraltar', code: 'GI' }, + { name: 'Greece', code: 'GR' }, + { name: 'Greenland', code: 'GL' }, + { name: 'Grenada', code: 'GD' }, + { name: 'Guadeloupe', code: 'GP' }, + { name: 'Guam', code: 'GU' }, + { name: 'Guatemala', code: 'GT' }, + { name: 'Guernsey', code: 'GG' }, + { name: 'Guinea', code: 'GN' }, + { name: 'Guinea-Bissau', code: 'GW' }, + { name: 'Guyana', code: 'GY' }, + { name: 'Haiti', code: 'HT' }, + { name: 'Heard Island and Mcdonald Islands', code: 'HM' }, + { name: 'Holy See (Vatican City State)', code: 'VA' }, + { name: 'Honduras', code: 'HN' }, + { name: 'Hong Kong', code: 'HK' }, + { name: 'Hungary', code: 'HU' }, + { name: 'Iceland', code: 'IS' }, + { name: 'India', code: 'IN' }, + { name: 'Indonesia', code: 'ID' }, + { name: 'Iran, Islamic Republic Of', code: 'IR' }, + { name: 'Iraq', code: 'IQ' }, + { name: 'Ireland', code: 'IE' }, + { name: 'Isle of Man', code: 'IM' }, + { name: 'Israel', code: 'IL' }, + { name: 'Italy', code: 'IT' }, + { name: 'Jamaica', code: 'JM' }, + { name: 'Japan', code: 'JP' }, + { name: 'Jersey', code: 'JE' }, + { name: 'Jordan', code: 'JO' }, + { name: 'Kazakhstan', code: 'KZ' }, + { name: 'Kenya', code: 'KE' }, + { name: 'Kiribati', code: 'KI' }, + { name: "Korea, Democratic People'S Republic of", code: 'KP' }, + { name: 'Korea, Republic of', code: 'KR' }, + { name: 'Kuwait', code: 'KW' }, + { name: 'Kyrgyzstan', code: 'KG' }, + { name: "Lao People'S Democratic Republic", code: 'LA' }, + { name: 'Latvia', code: 'LV' }, + { name: 'Lebanon', code: 'LB' }, + { name: 'Lesotho', code: 'LS' }, + { name: 'Liberia', code: 'LR' }, + { name: 'Libyan Arab Jamahiriya', code: 'LY' }, + { name: 'Liechtenstein', code: 'LI' }, + { name: 'Lithuania', code: 'LT' }, + { name: 'Luxembourg', code: 'LU' }, + { name: 'Macao', code: 'MO' }, + { name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK' }, + { name: 'Madagascar', code: 'MG' }, + { name: 'Malawi', code: 'MW' }, + { name: 'Malaysia', code: 'MY' }, + { name: 'Maldives', code: 'MV' }, + { name: 'Mali', code: 'ML' }, + { name: 'Malta', code: 'MT' }, + { name: 'Marshall Islands', code: 'MH' }, + { name: 'Martinique', code: 'MQ' }, + { name: 'Mauritania', code: 'MR' }, + { name: 'Mauritius', code: 'MU' }, + { name: 'Mayotte', code: 'YT' }, + { name: 'Mexico', code: 'MX' }, + { name: 'Micronesia, Federated States of', code: 'FM' }, + { name: 'Moldova, Republic of', code: 'MD' }, + { name: 'Monaco', code: 'MC' }, + { name: 'Mongolia', code: 'MN' }, + { name: 'Montserrat', code: 'MS' }, + { name: 'Morocco', code: 'MA' }, + { name: 'Mozambique', code: 'MZ' }, + { name: 'Myanmar', code: 'MM' }, + { name: 'Namibia', code: 'NA' }, + { name: 'Nauru', code: 'NR' }, + { name: 'Nepal', code: 'NP' }, + { name: 'Netherlands', code: 'NL' }, + { name: 'Netherlands Antilles', code: 'AN' }, + { name: 'New Caledonia', code: 'NC' }, + { name: 'New Zealand', code: 'NZ' }, + { name: 'Nicaragua', code: 'NI' }, + { name: 'Niger', code: 'NE' }, + { name: 'Nigeria', code: 'NG' }, + { name: 'Niue', code: 'NU' }, + { name: 'Norfolk Island', code: 'NF' }, + { name: 'Northern Mariana Islands', code: 'MP' }, + { name: 'Norway', code: 'NO' }, + { name: 'Oman', code: 'OM' }, + { name: 'Pakistan', code: 'PK' }, + { name: 'Palau', code: 'PW' }, + { name: 'Palestinian Territory, Occupied', code: 'PS' }, + { name: 'Panama', code: 'PA' }, + { name: 'Papua New Guinea', code: 'PG' }, + { name: 'Paraguay', code: 'PY' }, + { name: 'Peru', code: 'PE' }, + { name: 'Philippines', code: 'PH' }, + { name: 'Pitcairn', code: 'PN' }, + { name: 'Poland', code: 'PL' }, + { name: 'Portugal', code: 'PT' }, + { name: 'Puerto Rico', code: 'PR' }, + { name: 'Qatar', code: 'QA' }, + { name: 'Reunion', code: 'RE' }, + { name: 'Romania', code: 'RO' }, + { name: 'Russian Federation', code: 'RU' }, + { name: 'RWANDA', code: 'RW' }, + { name: 'Saint Helena', code: 'SH' }, + { name: 'Saint Kitts and Nevis', code: 'KN' }, + { name: 'Saint Lucia', code: 'LC' }, + { name: 'Saint Pierre and Miquelon', code: 'PM' }, + { name: 'Saint Vincent and the Grenadines', code: 'VC' }, + { name: 'Samoa', code: 'WS' }, + { name: 'San Marino', code: 'SM' }, + { name: 'Sao Tome and Principe', code: 'ST' }, + { name: 'Saudi Arabia', code: 'SA' }, + { name: 'Senegal', code: 'SN' }, + { name: 'Serbia and Montenegro', code: 'CS' }, + { name: 'Seychelles', code: 'SC' }, + { name: 'Sierra Leone', code: 'SL' }, + { name: 'Singapore', code: 'SG' }, + { name: 'Slovakia', code: 'SK' }, + { name: 'Slovenia', code: 'SI' }, + { name: 'Solomon Islands', code: 'SB' }, + { name: 'Somalia', code: 'SO' }, + { name: 'South Africa', code: 'ZA' }, + { name: 'South Georgia and the South Sandwich Islands', code: 'GS' }, + { name: 'Spain', code: 'ES' }, + { name: 'Sri Lanka', code: 'LK' }, + { name: 'Sudan', code: 'SD' }, + { name: 'Suriname', code: 'SR' }, + { name: 'Svalbard and Jan Mayen', code: 'SJ' }, + { name: 'Swaziland', code: 'SZ' }, + { name: 'Sweden', code: 'SE' }, + { name: 'Switzerland', code: 'CH' }, + { name: 'Syrian Arab Republic', code: 'SY' }, + { name: 'Taiwan, Province of China', code: 'TW' }, + { name: 'Tajikistan', code: 'TJ' }, + { name: 'Tanzania, United Republic of', code: 'TZ' }, + { name: 'Thailand', code: 'TH' }, + { name: 'Timor-Leste', code: 'TL' }, + { name: 'Togo', code: 'TG' }, + { name: 'Tokelau', code: 'TK' }, + { name: 'Tonga', code: 'TO' }, + { name: 'Trinidad and Tobago', code: 'TT' }, + { name: 'Tunisia', code: 'TN' }, + { name: 'Turkey', code: 'TR' }, + { name: 'Turkmenistan', code: 'TM' }, + { name: 'Turks and Caicos Islands', code: 'TC' }, + { name: 'Tuvalu', code: 'TV' }, + { name: 'Uganda', code: 'UG' }, + { name: 'Ukraine', code: 'UA' }, + { name: 'United Arab Emirates', code: 'AE' }, + { name: 'United Kingdom', code: 'GB' }, + { name: 'United States', code: 'US' }, + { name: 'United States Minor Outlying Islands', code: 'UM' }, + { name: 'Uruguay', code: 'UY' }, + { name: 'Uzbekistan', code: 'UZ' }, + { name: 'Vanuatu', code: 'VU' }, + { name: 'Venezuela', code: 'VE' }, + { name: 'Viet Nam', code: 'VN' }, + { name: 'Virgin Islands, British', code: 'VG' }, + { name: 'Virgin Islands, U.S.', code: 'VI' }, + { name: 'Wallis and Futuna', code: 'WF' }, + { name: 'Western Sahara', code: 'EH' }, + { name: 'Yemen', code: 'YE' }, + { name: 'Zambia', code: 'ZM' }, + { name: 'Zimbabwe', code: 'ZW' }, + ]); + selectedCountry = { name: 'Ireland', code: 'IE' }; + selectedCountry2 = { name: 'New Zealand', code: 'NZ' }; + + @action + raisedButton() { + alert('You pressed a raised button.'); + } + + @action + flatButton() { + alert('You pressed a flat button.'); + } + + @action + targetButton() { + alert('You pressed a target button.'); + } + + // Checkbox + checkboxValue1 = true; + checkboxValue2 = false; + checkboxValue3 = false; + checkboxValue4 = false; + checkboxValue5 = false; + @tracked checkboxValue6 = false; + @tracked checkboxValue7 = undefined; + get checkboxIsIndeterminate() { + return this.checkboxValue7 === undefined; + } + @action checkboxToggleCheckValue6() { + this.checkboxValue6 = !this.checkboxValue6; + } + + // Chips + @tracked chipsFruitNames = A(['Apple', 'Banana', 'Orange']); + @action chipsRemoveItem(item) { + this.chipsFruitNames.removeObject(item); + } + @action chipsAddItem(item) { + this.chipsFruitNames.pushObject(item); + } + + @tracked chipsCustomFruitNames = A(['Apple', 'Banana', 'Orange']); + @action chipsRemoveCustomItem(item) { + this.chipsCustomFruitNames.removeObject(item); + } + @action chipsAddCustomItem(item) { + this.chipsCustomFruitNames.pushObject(item); + } + + @tracked chipsVegeNames = A(['Broccoli']); + @tracked chipsAllVegeNames = A([ + 'Broccoli', + 'Cabbage', + 'Carrot', + 'Lettuce', + 'Spinach', + ]); + get chipsRemainingVegeNames() { + return this.chipsAllVegeNames.filter((source) => { + return !this.chipsVegeNames.any(function (myVegeName) { + return source === myVegeName; + }); + }); + } + + @tracked chipsVegetables = A([ + { + name: 'Broccoli', + family: 'Brassica', + }, + ]); + @action chipsRemoveVegetable(item) { + this.chipsVegetables.removeObject(item); + } + @action chipsAddVegetable(item) { + this.chipsVegetables.pushObject(item); + } + + @tracked chipsAllVegetables = A([ + { + name: 'Broccoli', + family: 'Brassica', + }, + { + name: 'Cabbage', + family: 'Brassica', + }, + { + name: 'Carrot', + family: 'Umbelliferous', + }, + { + name: 'Lettuce', + family: 'Composite', + }, + { + name: 'Spinach', + family: 'Goosefoot', + }, + ]); + get chipsRemainingVegetables() { + return this.chipsAllVegetables.filter((source) => { + return !this.chipsVegetables.any(function (myVegetable) { + return source.name === myVegetable.name; + }); + }); + } + @action chipsRemoveVegeName(item) { + this.chipsVegeNames.removeObject(item); + } + @action chipsAddVegeName(item) { + this.chipsVegeNames.pushObject(item); + } + + // Contact Chips + contactChipsNumOfContacts = 10; + get contactChipsContacts() { + let contacts = []; + let numOfContacts = this.contactChipsNumOfContacts; + + for (let i = 0; i < numOfContacts; i++) { + contacts.push({ + name: faker.person.fullName(), + email: faker.internet.email(), + image: faker.image.avatar(), + }); + } + + return contacts; + } + get contactChipsSelectedContacts() { + return this.contactChipsContacts.filter((c, index) => { + return index % 2 === 0; + }); + } + get contactChipsRemainingContacts() { + return this.contactChipsContacts.filter((c) => { + return this.contactChipsSelectedContacts.indexOf(c) === -1; + }); + } + @action contactChipsAddContact(item) { + this.contactChipsSelectedContacts.pushObject(item); + } + @action contactChipsRemoveContact(item) { + this.contactChipsSelectedContacts.removeObject(item); + } + + // Dialog + @tracked dialogShowDialog = true; + @action dialogToggleOpen() { + this.dialogShowDialog = !this.dialogShowDialog; + } + + // Grid List + get gridListTiles() { + let tiles = buildGridModel({ + title: 'Svg-', + background: '', + }); + + return A(tiles); + } + + // List + listNumOfRows = 3; + get listData() { + let contacts = []; + let numOfRows = this.listNumOfRows; + + for (let i = 0; i < numOfRows; i++) { + contacts.push({ + name: faker.person.fullName(), + email: faker.internet.email(), + img: faker.image.dataUri(), + }); + } + + return contacts; + } + listPhoneNumbers = Object.freeze([ + { + number: '(555) 251-1234', + type: 'Home', + }, + { + number: '(555) 786-9841', + type: 'Mobile', + }, + { + number: '(555) 314-1592', + type: 'Office', + }, + ]); + listToppings = Object.freeze([ + { + name: 'Pepperoni', + enabled: false, + }, + { + name: 'Sausage', + enabled: false, + }, + { + name: 'Black Olives', + enabled: true, + }, + { + name: 'Green Peppers', + enabled: false, + }, + ]); + listMessageData = Object.freeze([ + { + message: 'Message A', + }, + { + message: 'Message B', + }, + { + message: 'Message C', + }, + ]); + @action listTransitionTo(value) { + alert(`Imagine you transition to "${value}" here.`); + } + @action listTransitionToMenu() { + alert(`Imagine you transition to a menu here.`); + } + @action listSecondaryMessageClick() { + alert('Secondary actions can be used for one click actions.'); + } + + // Menu + menuOptions = A([1, 2, 3, 4, 5]); + menuItems = A([ + { + icon: 'access_alarms', + title: 'Alarm', + isFirst: true, + }, + { + icon: 'airplay', + title: 'Airplay', + }, + + { + icon: 'airplanemode_active', + title: 'Airplane mode', + }, + ]); + @action menuOpenSomething() { + alert('Some action handler.'); + } + + // Progress + @tracked progressDeterminateValue = 0; + @tracked progressDeterminateValue2 = 0; + @tracked progressTimer = null; + @tracked progressTimer2 = null; + @action progressStart() { + this.progressDeterminateValue = 30; + this.progressDeterminateValue2 = 30; + this.progressSetupTimer(); + this.progressSetupTimer2(); + } + progressSetupTimer() { + this.progressTimer = later( + this, + function () { + this.progressDeterminateValue += 1; + this.progressDeterminateValue2 += 1.5; + if (this.progressDeterminateValue > 100) { + this.progressDeterminateValue = 30; + this.progressDeterminateValue2 = 30; + } + + this.progressSetupTimer(); + }, + 100 + ); + } + progressSetupTimer2() { + this.progressTimer2 = later( + this, + function () { + this.mode = this.mode === 'query' ? 'determinate' : 'query'; + this.determinateValue = 30; + this.determinateValue2 = 30; + later(this, this.progressSetupTimer2); + }, + 7200 + ); + } + @action progressStop() { + cancel(this.progressTimer); + cancel(this.progressTimer2); + } + + // Select + @tracked selectSelectedState = this.selectStates.objectAt(4); + get selectStates() { + return A( + 'AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY' + .split(' ') + .map((state) => ({ abbrev: state })) + ); + } + + // Sidenav + @tracked sidenavRightSideBarOpen = true; + + // Slider + @tracked sliderColor = { + red: 55, + green: 111, + blue: 222, + }; + @tracked sliderDisabled1 = 22; + @tracked sliderRating1 = 3; + @tracked sliderRating2 = 2; + @tracked sliderRating3 = 4; + + // Speed Dial + @tracked speedDialOpen = true; + + // Switch + @tracked switchProp1 = true; + @tracked switchProp2 = false; + @tracked switchProp3 = false; + @tracked switchProp4 = false; + @tracked switchProp5 = false; + @action switchToggle(which, newValue) { + this[`switchProp${which}`] = newValue; + } + + // Tabs + tabsSelectedTab = 0; + @service router; + get tabsCurrentRouteName() { + return this.router.currentRouteName; + } + + // Toast + toastDuration = 60000; +} diff --git a/tests/dummy/app/controllers/demo/chips.js b/tests/dummy/app/controllers/demo/chips.js index 579772be0..1b47be8ef 100644 --- a/tests/dummy/app/controllers/demo/chips.js +++ b/tests/dummy/app/controllers/demo/chips.js @@ -20,7 +20,7 @@ export default Controller.extend({ contacts.push({ name: faker.person.fullName(), email: faker.internet.email(), - image: faker.internet.avatar() + image: faker.image.avatar(), }); } @@ -48,7 +48,7 @@ export default Controller.extend({ contacts.push({ shortName: `${firstName} ${lastName[0]}`, emailAddress: `${firstName.toLowerCase()}.${lastName[0].toLowerCase()}@example.com`, - profileImage: faker.internet.avatar() + profileImage: faker.image.avatar(), }); } diff --git a/tests/dummy/app/controllers/demo/grid-list.js b/tests/dummy/app/controllers/demo/grid-list.js index cea66a2c6..048bf8c7c 100644 --- a/tests/dummy/app/controllers/demo/grid-list.js +++ b/tests/dummy/app/controllers/demo/grid-list.js @@ -3,79 +3,7 @@ import Controller from '@ember/controller'; import { later } from '@ember/runloop'; import { A } from '@ember/array'; import EObject, { computed } from '@ember/object'; -import { assign } from '@ember/polyfills'; - -const COLORS = Object.freeze(['#ffebee', '#ffcdd2', '#ef9a9a', '#e57373', '#ef5350', '#f44336', '#e53935', '#d32f2f', '#c62828', '#b71c1c', '#ff8a80', '#ff5252', '#ff1744', '#d50000', '#f8bbd0', '#f48fb1', '#f06292', '#ec407a', '#e91e63', '#d81b60', '#c2185b', '#ad1457', '#880e4f', '#ff80ab', '#ff4081', '#f50057', '#c51162', '#e1bee7', '#ce93d8', '#ba68c8', '#ab47bc', '#9c27b0', '#8e24aa', '#7b1fa2', '#4a148c', '#ea80fc', '#e040fb', '#d500f9', '#aa00ff', '#ede7f6', '#d1c4e9', '#b39ddb', '#9575cd', '#7e57c2', '#673ab7', '#5e35b1', '#4527a0', '#311b92', '#b388ff', '#7c4dff', '#651fff', '#6200ea', '#c5cae9', '#9fa8da', '#7986cb', '#5c6bc0', '#3f51b5', '#3949ab', '#303f9f', '#283593', '#1a237e', '#8c9eff', '#536dfe', '#3d5afe', '#304ffe', '#e3f2fd', '#bbdefb', '#90caf9', '#64b5f6', '#42a5f5', '#2196f3', '#1e88e5', '#1976d2', '#1565c0', '#0d47a1', '#82b1ff', '#448aff', '#2979ff', '#2962ff', '#b3e5fc', '#81d4fa', '#4fc3f7', '#29b6f6', '#03a9f4', '#039be5', '#0288d1', '#0277bd', '#01579b', '#80d8ff', '#40c4ff', '#00b0ff', '#0091ea', '#e0f7fa', '#b2ebf2', '#80deea', '#4dd0e1', '#26c6da', '#00bcd4', '#00acc1', '#0097a7', '#00838f', '#006064', '#84ffff', '#18ffff', '#00e5ff', '#00b8d4', '#e0f2f1', '#b2dfdb', '#80cbc4', '#4db6ac', '#26a69a', '#009688', '#00897b', '#00796b', '#00695c', '#a7ffeb', '#64ffda', '#1de9b6', '#00bfa5', '#e8f5e9', '#c8e6c9', '#a5d6a7', '#81c784', '#66bb6a', '#4caf50', '#43a047', '#388e3c', '#2e7d32', '#1b5e20', '#b9f6ca', '#69f0ae', '#00e676', '#00c853', '#f1f8e9', '#dcedc8', '#c5e1a5', '#aed581', '#9ccc65', '#8bc34a', '#7cb342', '#689f38', '#558b2f', '#33691e', '#ccff90', '#b2ff59', '#76ff03', '#64dd17', '#f9fbe7', '#f0f4c3', '#e6ee9c', '#dce775', '#d4e157', '#cddc39', '#c0ca33', '#afb42b', '#9e9d24', '#827717', '#f4ff81', '#eeff41', '#c6ff00', '#aeea00', '#fffde7', '#fff9c4', '#fff59d', '#fff176', '#ffee58', '#ffeb3b', '#fdd835', '#fbc02d', '#f9a825', '#f57f17', '#ffff8d', '#ffff00', '#ffea00', '#ffd600', '#fff8e1', '#ffecb3', '#ffe082', '#ffd54f', '#ffca28', '#ffc107', '#ffb300', '#ffa000', '#ff8f00', '#ff6f00', '#ffe57f', '#ffd740', '#ffc400', '#ffab00', '#fff3e0', '#ffe0b2', '#ffcc80', '#ffb74d', '#ffa726', '#ff9800', '#fb8c00', '#f57c00', '#ef6c00', '#e65100', '#ffd180', '#ffab40', '#ff9100', '#ff6d00', '#fbe9e7', '#ffccbc', '#ffab91', '#ff8a65', '#ff7043', '#ff5722', '#f4511e', '#e64a19', '#d84315', '#bf360c', '#ff9e80', '#ff6e40', '#ff3d00', '#dd2c00', '#d7ccc8', '#bcaaa4', '#795548', '#d7ccc8', '#bcaaa4', '#8d6e63', '#eceff1', '#cfd8dc', '#b0bec5', '#90a4ae', '#78909c', '#607d8b', '#546e7a', '#cfd8dc', '#b0bec5', '#78909c']); - -function buildGridModel(tileTmpl) { - let results = []; - - for (let j = 0; j < 11; j++) { - - let it = assign({}, tileTmpl); - it.icon = it.icon + (j + 1); - it.title = it.title + (j + 1); - it.span = { row: 1, col: 1 }; - - switch (j + 1) { - case 1: - it.background = 'red'; - it.span.row = it.span.col = 2; - break; - case 2: - it.background = 'green'; - break; - case 3: - it.background = 'darkBlue'; - break; - case 4: - it.background = 'blue'; - it.span.col = 2; - break; - case 5: - it.background = 'yellow'; - it.span.row = it.span.col = 2; - break; - case 6: - it.background = 'pink'; - break; - case 7: - it.background = 'darkBlue'; - break; - case 8: - it.background = 'purple'; - break; - case 9: - it.background = 'deepBlue'; - break; - case 10: - it.background = 'lightPurple'; - break; - case 11: - it.background = 'yellow'; - break; - } - - results.push(it); - } - return results; -} - -function randomColor() { - let color = COLORS[Math.floor(Math.random() * COLORS.length)]; - return color.replace('#', 'bg-'); -} - -function randomSpan() { - let r = Math.random(); - if (r < 0.8) { - return 'gt-sm-1'; - } else if (r < 0.9) { - return 'gt-sm-2'; - } else { - return 'gt-sm-3'; - } -} +import { buildGridModel, randomColor, randomSpan } from '../../utils/grid-list'; export default Controller.extend({ diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index 529c99272..219f9def9 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,4 +1,3 @@ -/* eslint-disable prettier/prettier */ import EmberRouter from '@ember/routing/router'; import config from 'dummy/config/environment'; @@ -7,15 +6,18 @@ export default class Router extends EmberRouter { rootURL = config.rootURL; } -Router.map(function() { +Router.map(function () { this.route('introduction'); + this.route('catalog', function () { + this.route('nested-route'); + }); this.route('forms'); this.route('typography'); this.route('theme'); this.route('cookbook'); this.route('addons'); - this.route('demo', { path: 'components' }, function() { + this.route('demo', { path: 'components' }, function () { this.route('autocomplete'); this.route('button'); this.route('card'); @@ -28,7 +30,7 @@ Router.map(function() { this.route('input'); this.route('list'); this.route('menu'); - this.route('tabs', function() { + this.route('tabs', function () { this.route('nested-route'); }); this.route('progress-circular'); @@ -44,7 +46,7 @@ Router.map(function() { this.route('tooltip'); }); - this.route('layout', function() { + this.route('layout', function () { this.route('introduction'); this.route('layout-containers'); this.route('layout-children'); diff --git a/tests/dummy/app/styles/app.scss b/tests/dummy/app/styles/app.scss index 64b50ec70..660e1a751 100644 --- a/tests/dummy/app/styles/app.scss +++ b/tests/dummy/app/styles/app.scss @@ -3,6 +3,7 @@ $warn: 'amber'; $accent: 'pink'; @import 'ember-paper'; +@import 'catalog'; @import 'demo'; /** diff --git a/tests/dummy/app/styles/catalog.scss b/tests/dummy/app/styles/catalog.scss new file mode 100644 index 000000000..1b7f48a9f --- /dev/null +++ b/tests/dummy/app/styles/catalog.scss @@ -0,0 +1,11 @@ +.dialog-catalog { + min-height: 350px; +} + +.toast-catalog { + min-height: 150px; + + &--override-position { + position: relative !important; + } +} diff --git a/tests/dummy/app/templates/catalog.hbs b/tests/dummy/app/templates/catalog.hbs new file mode 100644 index 000000000..2b603fe04 --- /dev/null +++ b/tests/dummy/app/templates/catalog.hbs @@ -0,0 +1,1987 @@ + + + +

Autocomplete

+
+ +

+ +

+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +

Button

+
+ +
+ Button with action + Primary (noink) + disabled + warn + accent + href link + +
+

+ + Button with action + + Primary + disabled + warn + accent +

+ +

+ + Button with target + + + Button with bubble + + + Button no bubble + +

+
+ +

+ Fab + Fab + + Mini + Mini + + + + +

+ +

+ +

+
+
+ + + +

Card

+
+ +
+
+ + + + Card with image + Large + + + + + Action 1 + Action 2 + + + + + + + Card with block + Extra large + + + + +
+
+ + + + + + + + + + + +
+
+
+ +
+ + + + Card with image + Small + + + + + Action 1 + Action 2 + + + + + + + Card with block + Medium + + +
+
+
+ + Action 1 + Action 2 + +
+
+
+ +
+
+ + + + + Action buttons + + + +

+ The titles of Washed Out's breakthrough song and the first + single from Paracosm share the two most important words in + Ernest Greene's musical language: feel it. It's a simple + request, as well... +

+

+ The titles of Washed Out's breakthrough song and the first + single from Paracosm share the two most important words in + Ernest Greene's musical language: feel it. It's a simple + request, as well... +

+

+ The titles of Washed Out's breakthrough song and the first + single from Paracosm share the two most important words in + Ernest Greene's musical language: feel it. It's a simple + request, as well... +

+
+ + Action 1 + Action 2 + +
+ + + + + + Vertical action buttons + + + +

+ The titles of Washed Out's breakthrough song and the first + single from Paracosm share the two most important words in + Ernest Greene's musical language: feel it. It's a simple + request, as well... +

+
+ + Action 1 + Action 2 + +
+
+ +
+ + + + + Icon action buttons + + + +

+ The titles of Washed Out's breakthrough song and the first + single from Paracosm share the two most important words in + Ernest Greene's musical language: feel it. It's a simple + request, as well... +

+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + tomster + + + Ember + Paper + + + + + + Card header + + + +

+ The titles of Washed Out's breakthrough song and the first + single from Paracosm share the two most important words in + Ernest Greene's musical language: feel it. It's a simple + request, as well... +

+
+
+
+
+
+
+ + + +

Checkbox

+
+ +
+ + A checkbox: + {{this.checkboxValue1}} + + + + A checkbox: + {{if this.checkboxValue2 'yep' 'nope'}} + + + + Checkbox (disabled) + + + + Checkbox (disabled and value) + + + + Checkbox (no ink) + + + + + + Indeterminate checkbox + + + + Indeterminate checkbox (disabled) + +
+
+
+ + + +

Chips

+
+ + +

default template

+ + + {{item}} + (fruit) + +

custom template

+ +

Chips with Autocomplete

+ + {{item.name}} + {{#if item.family}} + {{item.family}} + {{/if}} + +

Chips with Autocomplete

+ + +

Chips with Autocomplete (requires match)

+
+
+ + + +

Contact Chips

+
+ + +

default

+ + +

read only contact chips

+
+
+ + + +

Dialog

+
+ +
+
+ +
+ + Open Dialog + +
+
+
+
+ + + + +

Divider

+
+ + +

divider: default

+ + +

divider: inset

+
+
+ + + +

Grid List: default

+
+ + + + + +

#1: (3r x 2c)

+
+
+ + + +

#2: (1r x 1c)

+
+
+ + + +

#3: (1r x 1c)

+
+
+ + + +

#4: (2r x 1c)

+
+
+ + + +

#5: (2r x 2c)

+
+
+ + + +

#6: (2r x 1c)

+
+
+ +
+
+
+ + + +

Grid List: dynamic tiles

+
+ + + + {{#each this.gridListTiles as |dynamicTile|}} + + + +

{{dynamicTile.title}}

+
+
+ {{/each}} + +
+
+
+ + + +

Icons

+
+ + + + + + +

default

+ + + +

spinners

+
+
+ + + +

Input

+
+ +
+ + + +
+
+ + +
+
+
+ + + +

List

+
+ + + 3 line item + {{#each this.listData as |item|}} + + {{item.name}} +
+

{{item.name}}

+

{{item.email}}

+

Some longer notes here could be here. But they aren't.

+
+
+ {{/each}} + + + + 2 line item + {{#each this.listData as |item|}} + + {{item.name}} +
+

{{item.name}}

+

{{item.email}}

+
+
+ {{/each}} + + + + 3 line item, long paragraph + {{#each this.listData as |item|}} + + {{item.name}} +
+

{{item.name}}

+

+ Secondary line text Lorem ipsum dolor sit amet, consectetur + adipiscing elit. Nam massa quam. Nulla metus metus, ullamcorper + vel, tincidunt sed, euismod in, nibh. Quisque volutpat + condimentum velit. Class aptent taciti sociosqu ad litora + torquent per conubia nostra, per inceptos himenaeos. +

+
+
+ {{/each}} + + + + Icons + {{#each this.listPhoneNumbers as |phone|}} + + +
+

{{phone.number}}

+

{{phone.type}}

+
+
+ {{/each}} + +
+
+
+ + + +

List: controls

+
+ + + + Single Action Checkboxes + {{#each this.listToppings as |topping|}} + +

{{topping.name}}

+
+ +
+
+ {{/each}} + + + + Secondary Buttons + +

Clicking the button to the right will fire the secondary action

+
+ + More Info + +
+
+ +

Click anywhere to fire the primary action, or the button to fire + the secondary

+
+ + More Info + +
+
+ + + + Clickable Items with Secondary Controls + + +

Wi-Fi

+
+ +
+
+ + +

Bluetooth

+
+ +
+
+ + +

Data Usage

+
+ + + + Checkbox with Secondary Action + {{#each this.listMessageData as |item|}} + + +

{{item.message}}

+
+ + + +
+
+ {{/each}} + + + + Avatar with Secondary Action Icon + {{#each this.listData as |item|}} + + {{item.name}} +

{{item.name}}

+
+ + + + + + + +
+
+ {{/each}} + + + + Clickable Avatars + {{#each this.listData as |item|}} + + {{item.name}} +
+

{{item.name}}

+

{{item.email}}

+

Some notes here.

+
+
+ {{/each}} + + + + Avatar with Secondary Action Icon + {{#each this.listData as |item|}} + + {{item.name}} +
+

{{item.name}}

+

{{item.email}}

+

Some notes here.

+
+ + + +
+ {{/each}} + + Single Action Radios + {{#each this.listToppings as |topping|}} + +

{{topping.name}}

+
+ +
+
+ {{/each}} +
+
+
+ + + +

Menu

+
+ + + +
+ + + +

Progress Circular

+
+ + +

determinate mode

+ +
+ + + + + +
+

non-determinate mode

+
+
+ + + +

Progress Linear

+
+ + +

determinate mode

+ + +

non-determinate mode

+ + +

buffer mode

+ + +

query mode

+
+
+ + + +

Radio

+
+ + + Toggable + + + + Disabled + + +
+ + + +

Select

+
+ +
+
+ + {{state.abbrev}} + +

default

+
+ +
+ + {{state.abbrev}} + +

disabled

+
+ +
+ + {{state.abbrev}} + +

required

+
+
+
+
+ + + +

Sidenav

+
+ + + + + + Left Sidenav + + + Çup? + + + + +
+

+ The left sidenav will "lock open" on a medium (>=960px wide) + device. The right sidenav never "locks open" because we set + lockedOpen=false. +

+

+ Left sidenav is + {{if + this.sidenavLeftSideBarOpen + 'opened' + 'closed' + }}. +

+

+ Right sidenav is + {{if + this.sidenavRightSideBarOpen + 'opened' + 'closed' + }}. +

+ + + + Toggle left sidenav + + + + + + Toggle right sidenav + + + +
+
+ + + + Right Sidenav + + + Çup? I'm on the right side. + + + +
+
+
+ + + +

Slider

+
+ + +

default

+ + +

md-warn

+ + +

md-primary

+ + +

disabled

+ +
+
+ R + + +
+ +
+ G + + +
+ +
+ B + + +
+

non-discrete

+
+
+
+ + + +

Speed Dial

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

up, fling

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

left, scale

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

right, fling

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

down, scale

+
+
+
+ + + +

Switch

+
+ + + {{this.switchProp1}} + + + + {{this.switchProp2}} + + + + Disabled switch + + + + Noink switch + + + + +
+ + + +

Tabs

+
+ + +
+ + + Page One + + + Page Two (disabled) + + + Page Three + + + Page Four + + + Page Five + + + +

default (dynamic stretching based on media queries)

+
+ +
+ + + Page One + + + Page Two (disabled) + + + Page Three + + + Page Four + + + Page Five + + + +

centered

+
+ +
+ + + Page One + + + Page Two (disabled) + + + Page Three + + + Page Four + + + Page Five + + + +

stretched

+
+ +
+ + + Page One + + + Page Two (disabled) + + + Page Three + + + Page Four + + + Page Five + + + +

bottom border

+
+ +
+ + + Index + + + Nested Route + + + + +

nested routing

+
+
+
+ + + +

Toast

+
+ +
+ + + default + + OK + + + + + capsule + + CANCEL + + + + + @class="md-accent" + + Wow, much accent + + + + + @class="md-warn" + + UNDO + + +
+
+ + + +

Toolbar

+
+ + + + + + +

+ Toolbar with Icon Buttons +

+ + + + + + + +
+
+ +
+ {{! with contextual components }} + + + + Go Back + +

Toolbar with Standard Buttons

+ + + Learn More + + + + +
+
+ +
+ + + +

Toolbar: tall=true, accent=true

+
+
+ +
+ + + + +

Toolbar: tall with actions pin to the bottom (tall=true warn=true)

+
+
+
+
+ + + +

Tooltip

+
+ +
+ + A button + + Hey! I'm a tooltip. Çup? + + +

position: bottom

+
+ +
+ + + + Create + + +

position: top

+
+ +
+ + + + Delete + + +

position: left

+
+ +
+ + + Icon tooltip + + +

position: right

+
+
+
+ +
+ +{{#if this.dialogShowDialog}} + +
+ + +

Mango (Fruit)

+ + + + +
+
+ + +

+ This is a dialog rendered into a specific element. Clicking outside + the dialog will close it. +

+
+ + + + + Cancel + + + OK + + +
+
+{{/if}} \ No newline at end of file diff --git a/tests/dummy/app/templates/catalog/index.hbs b/tests/dummy/app/templates/catalog/index.hbs new file mode 100644 index 000000000..7d58f48e8 --- /dev/null +++ b/tests/dummy/app/templates/catalog/index.hbs @@ -0,0 +1,2 @@ +

Index Route

+

This content lives in a nested "index" route.

diff --git a/tests/dummy/app/templates/catalog/nested-route.hbs b/tests/dummy/app/templates/catalog/nested-route.hbs new file mode 100644 index 000000000..7c68340ef --- /dev/null +++ b/tests/dummy/app/templates/catalog/nested-route.hbs @@ -0,0 +1,2 @@ +

Nested Route

+

This content lives in a nested "nested-route" route.

diff --git a/tests/dummy/app/utils/grid-list.js b/tests/dummy/app/utils/grid-list.js new file mode 100644 index 000000000..14360fd49 --- /dev/null +++ b/tests/dummy/app/utils/grid-list.js @@ -0,0 +1,306 @@ +import { assign } from '@ember/polyfills'; + +const COLORS = Object.freeze([ + '#ffebee', + '#ffcdd2', + '#ef9a9a', + '#e57373', + '#ef5350', + '#f44336', + '#e53935', + '#d32f2f', + '#c62828', + '#b71c1c', + '#ff8a80', + '#ff5252', + '#ff1744', + '#d50000', + '#f8bbd0', + '#f48fb1', + '#f06292', + '#ec407a', + '#e91e63', + '#d81b60', + '#c2185b', + '#ad1457', + '#880e4f', + '#ff80ab', + '#ff4081', + '#f50057', + '#c51162', + '#e1bee7', + '#ce93d8', + '#ba68c8', + '#ab47bc', + '#9c27b0', + '#8e24aa', + '#7b1fa2', + '#4a148c', + '#ea80fc', + '#e040fb', + '#d500f9', + '#aa00ff', + '#ede7f6', + '#d1c4e9', + '#b39ddb', + '#9575cd', + '#7e57c2', + '#673ab7', + '#5e35b1', + '#4527a0', + '#311b92', + '#b388ff', + '#7c4dff', + '#651fff', + '#6200ea', + '#c5cae9', + '#9fa8da', + '#7986cb', + '#5c6bc0', + '#3f51b5', + '#3949ab', + '#303f9f', + '#283593', + '#1a237e', + '#8c9eff', + '#536dfe', + '#3d5afe', + '#304ffe', + '#e3f2fd', + '#bbdefb', + '#90caf9', + '#64b5f6', + '#42a5f5', + '#2196f3', + '#1e88e5', + '#1976d2', + '#1565c0', + '#0d47a1', + '#82b1ff', + '#448aff', + '#2979ff', + '#2962ff', + '#b3e5fc', + '#81d4fa', + '#4fc3f7', + '#29b6f6', + '#03a9f4', + '#039be5', + '#0288d1', + '#0277bd', + '#01579b', + '#80d8ff', + '#40c4ff', + '#00b0ff', + '#0091ea', + '#e0f7fa', + '#b2ebf2', + '#80deea', + '#4dd0e1', + '#26c6da', + '#00bcd4', + '#00acc1', + '#0097a7', + '#00838f', + '#006064', + '#84ffff', + '#18ffff', + '#00e5ff', + '#00b8d4', + '#e0f2f1', + '#b2dfdb', + '#80cbc4', + '#4db6ac', + '#26a69a', + '#009688', + '#00897b', + '#00796b', + '#00695c', + '#a7ffeb', + '#64ffda', + '#1de9b6', + '#00bfa5', + '#e8f5e9', + '#c8e6c9', + '#a5d6a7', + '#81c784', + '#66bb6a', + '#4caf50', + '#43a047', + '#388e3c', + '#2e7d32', + '#1b5e20', + '#b9f6ca', + '#69f0ae', + '#00e676', + '#00c853', + '#f1f8e9', + '#dcedc8', + '#c5e1a5', + '#aed581', + '#9ccc65', + '#8bc34a', + '#7cb342', + '#689f38', + '#558b2f', + '#33691e', + '#ccff90', + '#b2ff59', + '#76ff03', + '#64dd17', + '#f9fbe7', + '#f0f4c3', + '#e6ee9c', + '#dce775', + '#d4e157', + '#cddc39', + '#c0ca33', + '#afb42b', + '#9e9d24', + '#827717', + '#f4ff81', + '#eeff41', + '#c6ff00', + '#aeea00', + '#fffde7', + '#fff9c4', + '#fff59d', + '#fff176', + '#ffee58', + '#ffeb3b', + '#fdd835', + '#fbc02d', + '#f9a825', + '#f57f17', + '#ffff8d', + '#ffff00', + '#ffea00', + '#ffd600', + '#fff8e1', + '#ffecb3', + '#ffe082', + '#ffd54f', + '#ffca28', + '#ffc107', + '#ffb300', + '#ffa000', + '#ff8f00', + '#ff6f00', + '#ffe57f', + '#ffd740', + '#ffc400', + '#ffab00', + '#fff3e0', + '#ffe0b2', + '#ffcc80', + '#ffb74d', + '#ffa726', + '#ff9800', + '#fb8c00', + '#f57c00', + '#ef6c00', + '#e65100', + '#ffd180', + '#ffab40', + '#ff9100', + '#ff6d00', + '#fbe9e7', + '#ffccbc', + '#ffab91', + '#ff8a65', + '#ff7043', + '#ff5722', + '#f4511e', + '#e64a19', + '#d84315', + '#bf360c', + '#ff9e80', + '#ff6e40', + '#ff3d00', + '#dd2c00', + '#d7ccc8', + '#bcaaa4', + '#795548', + '#d7ccc8', + '#bcaaa4', + '#8d6e63', + '#eceff1', + '#cfd8dc', + '#b0bec5', + '#90a4ae', + '#78909c', + '#607d8b', + '#546e7a', + '#cfd8dc', + '#b0bec5', + '#78909c', +]); + +export function buildGridModel(tileTmpl) { + let results = []; + + for (let j = 0; j < 11; j++) { + let it = assign({}, tileTmpl); + it.icon = it.icon + (j + 1); + it.title = it.title + (j + 1); + it.span = { row: 1, col: 1 }; + + switch (j + 1) { + case 1: + it.background = 'red'; + it.span.row = it.span.col = 2; + break; + case 2: + it.background = 'green'; + break; + case 3: + it.background = 'darkBlue'; + break; + case 4: + it.background = 'blue'; + it.span.col = 2; + break; + case 5: + it.background = 'yellow'; + it.span.row = it.span.col = 2; + break; + case 6: + it.background = 'pink'; + break; + case 7: + it.background = 'darkBlue'; + break; + case 8: + it.background = 'purple'; + break; + case 9: + it.background = 'deepBlue'; + break; + case 10: + it.background = 'lightPurple'; + break; + case 11: + it.background = 'yellow'; + break; + } + + results.push(it); + } + return results; +} + +export function randomColor() { + let color = COLORS[Math.floor(Math.random() * COLORS.length)]; + return color.replace('#', 'bg-'); +} + +export function randomSpan() { + let r = Math.random(); + if (r < 0.8) { + return 'gt-sm-1'; + } else if (r < 0.9) { + return 'gt-sm-2'; + } else { + return 'gt-sm-3'; + } +}