static NavigatorFactory calculate()

in module/geb-core/src/main/groovy/geb/content/ModuleBaseCalculator.groovy [30:52]


    static NavigatorFactory calculate(
            Browser browser, Module module, NavigatorFactory navigatorFactory, TargetLocator targetLocator,
            Map params = [:]
    ) {
        def moduleClass = module.getClass()
        def moduleBaseDefinition = moduleClass.base
        if (!moduleBaseDefinition) {
            navigatorFactory
        } else {
            // Clone it because the same closure may be used
            // via through a subclass and have a different base
            def moduleBaseDefinitionClone = moduleBaseDefinition.clone()
            moduleBaseDefinitionClone.delegate = new ModuleBaseDefinitionDelegate(browser, module, navigatorFactory, targetLocator, params)
            moduleBaseDefinitionClone.resolveStrategy = Closure.DELEGATE_FIRST
            def moduleBase = moduleBaseDefinitionClone()

            if (!(moduleBase instanceof Navigator)) {
                throw new InvalidPageContent("The static 'base' parameter of module class $moduleClass did not return a Navigator")
            }

            navigatorFactory.relativeTo(moduleBase)
        }
    }