FactoryGirl.define do factory :layer, class: Layer do to_create(&:save) order 1 kind 'carto' end factory :carto_tiled_layer, class: Carto::Layer do order 1 kind 'tiled' options do { "default": true, "url": "http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png", "subdomains": "abcd", "minZoom": "0", "maxZoom": "18", "attribution": "\u00a9 OpenStreetMap contributors \u00a9 CARTO", "urlTemplate": "http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png", "type": "Tiled", "className": "positron_rainbow", "name": "Positron (labels below)" } end end factory :carto_layer, class: Carto::Layer do order 2 kind 'carto' options do { interactivity: '', style_version: '2.1.1', table_name: nil, query: nil, tile_style: '#something {}' } end factory :carto_layer_with_infowindow do infowindow_light = { "fields": [{ "name": "country", "title": true, "position": 1 }], "template_name": "table/views/infowindow_light", "template": "", "alternative_names": {}, "width": 226, "maxHeight": 180 } infowindow infowindow_light end factory :carto_layer_with_tooltip do tooltip_light = { "fields": [{ "name": "amount", "title": true, "position": 0 }], "template_name": "tooltip_light", "template": "", "alternative_names": {}, "maxHeight": 180 } tooltip tooltip_light end factory :carto_layer_with_sql do ignore do table_name 'default_table' end options do { table_name: table_name, query: "select * from #{table_name}", sql_wrap: "select * from (<%= sql %>) __wrap" } end end end end module Fixtures module Layers module Tooltips def custom_tooltip(template = 'wadus tooltip') { "fields": [{ "name": "amount", "title": true, "position": 0 }], "template_name": "", "template": template, "alternative_names": {}, "maxHeight": 180 } end # These depend on tooltip_light.jst.mustache at the following paths: # - /lib/assets/javascripts/cartodb/table/views/tooltip/templates/tooltip_light.jst.mustache # - /lib/assets/javascripts/builder/mustache-templates/tooltips/tooltip_light.jst.mustache def v2_tooltip_light_template_fragment '
{{{ value }}}
\n {{/value}}\n "\ "{{^value}}\nnull
\n {{/value}}\n {{/content.fields}}\n "\ "