icon_test.icons.yml

core/modules/system/tests/modules/icon_test/icon_test.icons.yml

File

core/modules/system/tests/modules/icon_test/icon_test.icons.yml

View source
  1. test_minimal:
  2. extractor: path
  3. config:
  4. sources:
  5. - icons/flat/foo.png
  6. template: >-
  7. {{ icon_id }}: <img src="{{ source }}" width="32" height="32">
  8. test_path:
  9. enabled: true
  10. label: Test path
  11. description: Local png files available for test with all metadata.
  12. links:
  13. - https://www.drupal.org
  14. - https://www.drupal.org
  15. version: 1.0.0
  16. license:
  17. name: GPL-3.0-or-later
  18. url: https://www.gnu.org/licenses/gpl-3.0.html
  19. gpl-compatible: true
  20. extractor: path
  21. config:
  22. sources:
  23. - icons/flat/*.png
  24. - icons/group/{group}/*.png
  25. - icons/group/*/{group}/*.png
  26. # For tests keep same name attribute as HTML for IconPluginTest.
  27. settings:
  28. width:
  29. title: "Width"
  30. type: "integer"
  31. default: 32
  32. height:
  33. title: "Height"
  34. type: "integer"
  35. default: 33
  36. title:
  37. title: "Title"
  38. type: "string"
  39. default: 'Default title'
  40. # Template class is important for tests.
  41. template: >-
  42. {{ icon_id }}: <img
  43. class="icon icon-{{ icon_id|clean_class }}"
  44. src="{{ source }}"
  45. width="{{ width|default(32) }}"
  46. height="{{ height|default(33) }}"
  47. title="{{ title }}"
  48. >
  49. test_svg:
  50. enabled: true
  51. label: Test svg
  52. extractor: svg
  53. config:
  54. sources:
  55. - icons/flat/*.svg
  56. - icons/group/{group}/*.svg
  57. - icons/group/*/{group}/*.svg
  58. - icons/prefix_suffix/prefix_{icon_id}_suffix.svg
  59. settings:
  60. size:
  61. title: "Size"
  62. type: "integer"
  63. template: >-
  64. {{ icon_id }}: <svg
  65. xmlns="https://www.w3.org/2000/svg"
  66. viewBox="0 0 50 50"
  67. width="{{ size|default(32) }}"
  68. height="{{ size|default(32) }}"
  69. aria-hidden="true"
  70. >
  71. {{ content }}
  72. </svg>
  73. test_svg_sprite:
  74. enabled: true
  75. label: Test sprite
  76. extractor: svg_sprite
  77. config:
  78. sources:
  79. - icons/sprite/foo_sprite.svg
  80. settings:
  81. width:
  82. title: "Width"
  83. type: "integer"
  84. default: 32
  85. height:
  86. title: "Height"
  87. type: "integer"
  88. default: 32
  89. template: >-
  90. {{ icon_id }}: <svg
  91. {{ attributes
  92. .setAttribute('viewBox', attributes.viewBox|default('0 0 50 50'))
  93. .setAttribute('width', width|default('32'))
  94. .setAttribute('height', height|default('32'))
  95. }}
  96. >
  97. {{ content }}
  98. </svg>
  99. test_settings:
  100. enabled: true
  101. label: Test settings
  102. extractor: path
  103. config:
  104. sources:
  105. - icons/settings/*
  106. settings:
  107. width:
  108. title: "Width"
  109. description: "Set a width for this icon."
  110. type: "integer"
  111. default: 32
  112. height:
  113. title: "Height"
  114. description: "Set a height for this icon."
  115. type: "integer"
  116. default: 33
  117. title:
  118. title: "Title"
  119. type: "string"
  120. description: "Set a title on hover for this icon."
  121. default: "Default title"
  122. alt:
  123. title: "Alt text"
  124. type: "string"
  125. description: "Accessibility alternative text, leave empty for decorative icon."
  126. default: "Default alt"
  127. select:
  128. title: "Test select"
  129. description: "Test for a select with enum property."
  130. type: "integer"
  131. enum: [100, 200, 300, 400, 500, 600, 700, 800, 900]
  132. default: 400
  133. select_string:
  134. title: "Test select"
  135. description: "Test for a select with enum property."
  136. type: "string"
  137. enum: ['foo', 'bar']
  138. boolean:
  139. title: "Test boolean"
  140. description: "Test for a boolean property."
  141. type: "boolean"
  142. default: true
  143. decimal:
  144. title: "Test decimal"
  145. description: "Test for a decimal with step property."
  146. type: "number"
  147. default: 66.66
  148. multipleOf: 0.01
  149. number:
  150. title: "Test number min/max/step"
  151. description: "Test for number with constraints."
  152. type: "integer"
  153. default: 30
  154. minimum: 10
  155. maximum: 100
  156. multipleOf: 10
  157. template: >-
  158. {{ icon_id }}: <img
  159. class="icon icon-{{ icon_id|clean_class }}"
  160. src="{{ source }}"
  161. title="{{ title }}"
  162. alt="{{ alt }}"
  163. width="{{ width|default(32) }}"
  164. height="{{ height|default(32) }}"
  165. data-select="{{ select }}"
  166. data-boolean="{{ boolean }}"
  167. data-decimal="{{ decimal }}"
  168. data-number="{{ number }}"
  169. >
  170. <ul>
  171. <li>width: {{ width }}</li>
  172. <li>height: {{ height }}</li>
  173. <li>title: {{ title }}</li>
  174. <li>alt: {{ alt }}</li>
  175. <li>select: {{ select }}</li>
  176. <li>select_string: {{ select_string }}</li>
  177. <li>boolean: {{ boolean }}</li>
  178. <li>decimal: {{ decimal }}</li>
  179. <li>number: {{ number }}</li>
  180. </ul>
  181. test_no_settings:
  182. enabled: true
  183. extractor: path
  184. config:
  185. sources:
  186. - icons/no_settings/*.svg
  187. template: >-
  188. {{ icon_id }}: <img
  189. src="{{ source }}"
  190. width="32"
  191. height="32"
  192. >
  193. test_url_path:
  194. enabled: true
  195. label: Test url path
  196. extractor: path
  197. config:
  198. sources:
  199. - https://www.drupal.org/files/D10-logo.png
  200. - https://www.drupal.org/files/drupal-wordmark.png
  201. - htp://test.com/invalid.jpg
  202. template: >-
  203. {{ icon_id }}: <img src="{{ source }}" width="32" height="32">
  204. test_url_svg:
  205. enabled: true
  206. label: Test url svg empty
  207. extractor: svg
  208. config:
  209. sources:
  210. # This will be ignored.
  211. - https://www.drupal.org/files/drupal-wordmark.svg
  212. template: >-
  213. {{ icon_id }}: <svg xmlns="https://www.w3.org/2000/svg">
  214. {{ content }}
  215. </svg>
  216. test_url_svg_sprite:
  217. enabled: false
  218. label: Test url svg sprite disabled and empty
  219. extractor: svg_sprite
  220. config:
  221. sources:
  222. - https://test.com/ignored.png
  223. - https://test.com/ignored.gif
  224. template: >-
  225. <svg xmlns="https://www.w3.org/2000/svg">
  226. <use xlink:href="{{ source }}#{{ icon_id }}"/>
  227. </svg>
  228. test_no_icons:
  229. enabled: true
  230. label: No Icons
  231. extractor: path
  232. config:
  233. sources:
  234. - icons/empty/*
  235. template: '{{ icon_id }}'
  236. # @todo enable and log error instead.
  237. test_invalid_path:
  238. enabled: false
  239. extractor: path
  240. config:
  241. sources:
  242. - invalid_path/*.png
  243. template: '{{ icon_id }}'
  244. test_disabled:
  245. enabled: false
  246. extractor: path
  247. config:
  248. sources:
  249. - icons/png/*
  250. template: '{{ icon_id }}'

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.